环境配置:centos7
安装教程地址(官网文档):https://docs.docker.com/engine/install/centos/
- 卸载旧版本docker:
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
- 安装docker依赖包:
yum install -y yum-utils
- 安装docker的镜像访问地址:
yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
- 安装docker容器及客户端等等:
sudo yum -y install docker-ce docker-ce-cli containerd.io
- 验证docker是否安装成功:
docker -v
- 启动docker:
sudo systemctl start docker
- 设置开机自启:
systemctl enable docker
- 设置为阿里云镜像:
sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://pitt1zyj.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker