Docker安装
移除旧版本
1 2 3 4 5 6 7 8 9 10
| 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
|
安装
安装所需的软件包,并配置仓库。
1
| sudo yum install -y yum-utils device-mapper-persistent-data lvm2
|
1
| sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
|
更新yum缓存
安装
1
| sudo yum install docker-ce docker-ce-cli containerd.io
|
启动
1 2 3
| sudo systemctl start docker #或者 sudo service docker start
|
运行hello-world,第一次运行会提示本地没有该镜像,然后会自动下载运行。
1 2 3 4 5 6
| Unable to find image 'hello-world:latest' locally //本地没有这个镜像 latest: Pulling from library/hello-world //从远程拉取镜像
c04b14da8d14: Pull complete Digest: sha256:0256e8a36e2070f7bf2d0b0763dbabdd67798512411de4cdcf9431a1feb60fd9 Status: Downloaded newer image for hello-world:latest
|
卸载Docker
卸载依赖
1
| yum remove docker-ce docker-ce-cli containerd.io
|
删除资源