Docker—docker社区版安装

前置条件:

自己通过VMware安装,或者在阿里云上开通centos7以上的操作系统

下载XShell,建好链接

 

安装步骤:

1、安装yum工具集(yum-utils 简化安装源的配置过程)、docker数据存储驱动 device-mapper-persistent-data 和lvm2(docker存储需要依赖着两个驱动完成)

yum install -y yum-utils device-mapper-persistent-data lvm2

2、修改yum安装源,提高下载速度

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

3、安装docker最新版本

yum -y install docker-ce

等待安装,安装完成后提示如下:

Installed:
  docker-ce.x86_64 3:19.03.12-3.el7                                                                        

Dependency Installed:
  audit-libs-python.x86_64 0:2.8.5-4.el7                   checkpolicy.x86_64 0:2.5-8.el7                  
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8       containerd.io.x86_64 0:1.2.13-3.2.el7           
  docker-ce-cli.x86_64 1:19.03.12-3.el7                    libcgroup.x86_64 0:0.41-21.el7                  
  libsemanage-python.x86_64 0:2.5-14.el7                   policycoreutils-python.x86_64 0:2.5-34.el7      
  python-IPy.noarch 0:0.75-6.el7                           setools-libs.x86_64 0:3.3.8-4.el7               

Dependency Updated:
  audit.x86_64 0:2.8.5-4.el7    audit-libs.x86_64 0:2.8.5-4.el7    policycoreutils.x86_64 0:2.5-34.el7 

4、验证docker是否安装成功

service docker start

Docker—docker社区版安装_第1张图片

docker本身是CS架构,安装时会把客户端和服务器端都安装好,上图中使用的docker version命令就是客户端提供的

5、验证docker是否能够运行服务

从国外docker远程中央仓库中下载hello-world到本地

[root@iZ9dpaw7yt2qgeilkroafkZ ~]# docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:49a1c8800c94df04e9658809b006fd8a686cab8028d33cfba2cc049724254202
Status: Downloaded newer image for hello-world:latest
docker.io/library/hello-world:latest

6、创建docker容器并运行hello-world

[root@iZ9dpaw7yt2qgeilkroafkZ ~]# docker run hello-world

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/

出现Hello from Docker!代表centos上面的docker安装成功!

你可能感兴趣的:(docker)