Centos快速安装Docke

  • A+
所属分类:linux技术
摘要

预备
删除旧docker安装启动设置开机自启镜像加速(这里在阿里云申请:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors)

预备
删除旧docker

# 删除旧docker $ sudo yum remove docker                    docker-client                    docker-client-latest                    docker-common                    docker-latest                    docker-latest-logrotate                    docker-logrotate                    docker-engine 

安装

$ sudo yum install -y yum-utils  $ 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 

启动

# 启动 $ sudo systemctl start docker 

设置开机自启

# 开机自启 sudo systemctl enable docker 

镜像加速(这里在阿里云申请:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors)

# 创建/etc/docker/daemon.json文件 # 写入 {   "registry-mirrors": ["https://XXXXXX.mirror.aliyuncs.com"] } # 刷新配置 sudo systemctl daemon-reload # 重启docker sudo systemctl restart docker