sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
若需要安装指定版本的docker
sudo yum install docker-ce-18.09.1 docker-ce-cli-18.09.1 containerd.io
sudo systemctl start docker
sudo systemctl stop docker
sudo systemctl restart docker
sudo systemctl enable docker
sudo systemctl disable docker
在/etc/docker目录下 若存在daemon.json,就修改,若不存在,进行创建,内容为
{“registry-mirrors”:[“https://reg-mirror.qiniu.com/”,“https://hub-mirror.c.163.com/”]}
加载镜像加速
sudo systemctl daemon-reload
重启服务
sudo systemctl restart docker
sudo vi /usr/lib/systemd/system/docker.service
然后修改里面的ExecStart
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
增加 -H tcp://0.0.0.0:2375(端口号可自定义)
sudo systemctl restart docker
docker images -a
docker images -q -f dangling=true
docker images -q -f dangling=true | xargs docker rmi -f
docker run -itd -p 本地端口:容器端口 --name 容器名称 镜像名称/镜像ID
docker ps -a | grep 容器名 取第一列
docker ps -q -f "name=容器名" 直接获取容器ID
docker logs -f --tail 200 容器ID
docker exec -it 容器ID /bin/bash
exit
docker restart 容器ID
docker start 容器ID
docker stop 容器ID
docker rm 容器ID (若需强制删除 增加-f参数)
com.spotify
docker-maven-plugin
1.0.0
default
package
build
push
docker-aliyun
${docker-repository}
${docker-repository}/${docker.registry.name}/${project.name}:${project.version}
${project.version}
${project.basedir}/src/main/docker/
http://101.103.156.253:2375
${project.build.finalName}.jar
101+default+application.properties
/
${project.build.directory}
${project.build.finalName}.jar
101+default+application.properties
true
docker-aliyun
xxx
{SSHj8AYxgp0HaD6Zj86FOtpyBTmshzgk4nxbT3sYK1Y=}
[email protected]
{LysllZS6hQsHHrcLKMHhhiDkgXQPbVvB/C1jSErrsd8=}
FROM java:8
ARG JAR_FILE
ARG CONFIG_FILE
WORKDIR /opt/work/
ADD $JAR_FILE xxx.jar
ENTRYPOINT ["sh","-c","java -jar xxx.jar"]
mvn --encrypt-master-password "YourNEXUSPassword"
mvn --encrypt-password "YourNEXUSPassword"