基于CentOS 7环境下,yum安装docker

一,准备篇
1,配置网络&关闭SELINUX&配置防火墙

配置网络&关闭SELINUX&配置防火墙

二,安装篇
1,卸载旧版本
yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
2,设置稳定版yum repository
yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
3,安装docker
yum install docker-ce docker-ce-cli containerd.io

如果提示您接受GPG密钥,请验证指纹是否匹配 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35,如果是,则接受它。

4,启动docker
systemctl start docker
systemctl enable docker
systemctl disable docker
systemctl restart docker
5,docker镜像加速
vi /etc/docker/daemon.json
{
    "registry-mirrors": ["https://registry.docker-cn.com"]
}
systemctl daemon-reload
systemctl restart docker
6,卸载docker
#卸载docker软件包
yum remove docker-ce
#删除 映像,容器,卷或自定义配置文件
rm -rf /var/lib/docker
7,安装docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version

你可能感兴趣的:(基于CentOS 7环境下,yum安装docker)