離線安裝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