离线安装Docker CE 版本


1、下载 RPM包.
下载稳定版本的docker rpm 安装包. (https://download.docker.com/linux/centos/7/x86_64/stable/Packages/)

[root@namenode1 Downloads]# ll
total 56212
-rw-r--r--. 1 root root 23217684 Apr 4 15:32 containerd.io-1.2.5-3.1.el7.x86_64.rpm
-rw-r--r--. 1 root root 19625052 Apr 4 14:44 docker-ce-18.09.4-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 14678328 Apr 4 14:44 docker-ce-cli-18.09.4-3.el7.x86_64.rpm
-rw-r--r--. 1 root root 29392 Apr 4 15:36 docker-ce-selinux-17.03.3.ce-1.el7.noarch.rpm
 2、安装 
 下载完成4个安装包之后,按照如下顺序,执行命令进行安装.

yum -y install containerd.io-1.2.5-3.1.el7.x86_64.rpm
yum -y install docker-ce-selinux-17.03.3.ce-1.el7.noarch.rpm
yum -y install docker-ce-cli-18.09.4-3.el7.x86_64.rpm
yum -y install docker-ce-18.09.4-3.el7.x86_64.rpm
3、启动
systemctl start docker
4、确认Docker CE 是否正确安装.
运行hello-world镜像.

docker run hello-world
[root@namenode1 Downloads]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/
五、Docker 卸载
1、列出你已安装的Docker package.

[root@namenode1 ~]# yum list installed | grep docker
docker-ce.x86_64 3:18.09.4-3.el7 installed
docker-ce-cli.x86_64 1:18.09.4-3.el7 installed
2 、移除这个package

$ sudo yum -y remove docker-ce docker-ce-cli
这个命令没有移除images、containers、volumes或者你主机上用户创建的配置文件.

[root@namenode1 docker]# ll
total 0
drwx------. 2 root root 23 Apr 4 15:52 builder
drwx------. 4 root root 87 Apr 4 15:52 buildkit
drwx------. 3 root root 77 Apr 4 15:55 containers
drwx------. 5 root root 50 Apr 4 15:55 devicemapper
drwx------. 3 root root 25 Apr 4 15:52 image
drwxr-x---. 3 root root 18 Apr 4 15:52 network
drwx------. 4 root root 30 Apr 4 15:52 plugins
drwx------. 2 root root 6 Apr 4 15:52 runtimes
drwx------. 2 root root 6 Apr 4 15:52 swarm
drwx------. 2 root root 6 Apr 4 15:55 tmp
drwx------. 2 root root 6 Apr 4 15:52 trust
drwx------. 2 root root 24 Apr 4 15:52 volumes
3、要删除所有的images、containers、volumes,运行如下命令.

$ rm -rf /var/lib/docker
4、查找和删除任何用户创建的配置文件.
————————————————
版权声明:本文为CSDN博主「秋风小凉鱼」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yulei_qq/article/details/89021817


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM