5、在linux部署docker
一、安装docker
# 卸载原始docker
$ sudo yum remove docker /
docker-client /
docker-client-latest /
docker-common /
docker-latest /
docker-latest-logrotate /
docker-logrotate /
docker-engine
# 安装docker依赖
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
# 设置docker的yum源
$ sudo yum-config-manager /
--add-repo /
https://download.docker.com/linux/centos/docker-ce.repo
# 安装最新版的docker
$ sudo yum install docker-ce docker-ce-cli containerd.io
# 启动docker
$ sudo systemctl enable docker
$ sudo systemctl start docker
# 关闭docker
$ sudo systemctl stop docker
# 测试docker安装
$ sudo docker run hello-world
二、配置镜像
# 访问阿里云登录自己账号查看docker镜像加速服务
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
# 验证docker的镜像加速是否生效
sudo docker info
原创文章,作者:1402239773,如若转载,请注明出处:https://blog.ytso.com/273730.html