安装docker:
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate
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
systemctl start docker
docker run hello-world
运行 docker:
docker run -it -d -p 8080:8080 -v 映射路径(-v my-vol:/wepapp) -e 跟环境变量 XXX="haha"
更改私有仓库地址 文件/etc/docker/daemon.json
:
注意下面带有 http:// 和不带的不可以混用,混用会导致docker启动失败
{
"insecure-registries": [
"ip:port"
]
}
标记到远程仓库并推送:
docker tag image ip:port/image:v0.0.2
docker push ip:port/image:v0.0.2
docker run -it -d -p 8235:8235 --restart=always image:v0.0.2