Centos7下Docker的安装与卸载

x33g5p2x  于2022-05-05 转载在 Docker  
字(0.8k)|赞(0)|评价(0)|浏览(628)

Docker官网安装指南地址:https://docs.docker.com/engine/install/centos/

1. 查看CentOS版本

cat /etc/redhat-release

2. 卸载docker老版本

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

3. 验证CentOS联网

ping www.baidu.com

4. 安装gcc

yum -y install gcc

yum -y install gcc-c++

5. 安装docker软件包

yum install -y yum-utils

6. 配置stable镜像仓库(阿里云)

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

7. 安装Docker Engine

yum install docker-ce docker-ce-cli containerd.io docker-compose-pluginy

8. 启动docker

systemctl start docker

ps -ef|grep docker

9. 查看docker版本

docker version

10. 运行HelloWorld

docker run hello-world

11. 卸载docker

(1) 停止docker服务

systemctl stop docker

(2) remove

yum remove docker-ce docker-ce-cli containerd.io

(3) 清理残余文件

sudo rm -rf /var/lib/docker

sudo rm -rf /var/lib/containerd

相关文章