目录

1、下载 RPM包.

 2、安装 

3、启动

4、确认Docker CE 是否正确安装.

五、Docker 卸载


    参考:  https://docs.docker.com/install/overview/

    2019年,再看Docker ,已经分为CE 和EE 版本 。 CE 是社区版本,免费的。 EE 是企业版本,收费的.

    Docker Community Edition (CE)对于希望开始使用Docker并尝试基于容器的应用程序的个人开发人员和小型团队来说非常理想。

    Docker Enterprise Edition (EE)是为企业开发和IT团队设计的,这些团队在生产环境中构建、交付和运行业务关键应用程序。

今天我们就来离线安装Docker CE 版本。

 参考: https://docs.docker.com/install/linux/docker-ce/centos/#install-from-a-package

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、查找和删除任何用户创建的配置文件.

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐