基于CentOS的Docker安装教程

安装Docker详细步骤

1.更新yum源

sudo yum update

2.卸载旧版本的Docker

sudo yum remove docker \
 docker-client \
 docker-client-latest \
 docker-common \
 docker-latest \
 docker-latest-logrotate \
 docker-logrotate \
 docker-selinux \
 docker-engine-selinux \
 docker-engine

3.更改yum源为国内源

阿里云:

sudo yum-config-manager \
 --add-repo \
 https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo

官方源:

sudo yum-config-manager \
 --add-repo \
 https://download.docker.com/linux/centos/docker-ce.repo

4.安装Docker依赖包

sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

5.安装Docker

sudo yum install docker-ce docker-ce-cli containerd.io

6.启动Docker

sudo systemctl start docker

7.设置Docker开机自启

sudo systemctl enable docker

卸载Docker

卸载全部相关软件包

sudo yum remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras

删除所有镜像、容器、卷

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
作者:沦陷在梦里原文地址:https://www.cnblogs.com/fallingintodreams/p/17787760.html

%s 个评论

要回复文章请先登录注册