Centos 安装docker CE

Docker 分为“社区版CE”和“企业版EE”。

安装Docker,Centos版本最低为CentOS 7,内核高于3.10

1、查看当前系统内核

[jason@localhost ~]$ uname -r
3.10.0-229.el7.x86_64

2、使用存储库安装   ?? 

[root@localhost ~]# yum install -y yum-utils \device-mapper-persistent-data \lvm2

 

3、添加yum 源

 

[root@localhost ~]# curl -o /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo

3、安装docker-ce

[root@localhost ~]# yum install docker-ce

4、启动docker服务

[root@localhost ~]# systemctl start docker

5、查看docker服务

[root@localhost ~]# systemctl status docker

● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since 一 2019-05-20 23:37:33 CST; 8s ago
Docs: https://docs.docker.com
Main PID: 5134 (dockerd)
Memory: 33.4M
CGroup: /system.slice/docker.service
└─5134 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

5月 20 23:37:32 localhost.localdomain dockerd[5134]: time="2019-05-20T23:37:32.448031941+08:00" level=warning msg="[graphdriver] WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release"
5月 20 23:37:32 localhost.localdomain dockerd[5134]: time="2019-05-20T23:37:32.629078618+08:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
5月 20 23:37:32 localhost.localdomain dockerd[5134]: time="2019-05-20T23:37:32.630349445+08:00" level=warning msg="mountpoint for pids not found"
5月 20 23:37:32 localhost.localdomain dockerd[5134]: time="2019-05-20T23:37:32.630551966+08:00" level=info msg="Loading containers: start."
5月 20 23:37:33 localhost.localdomain dockerd[5134]: time="2019-05-20T23:37:33.140137359+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set...rred IP address"
5月 20 23:37:33 localhost.localdomain dockerd[5134]: time="2019-05-20T23:37:33.731108458+08:00" level=info msg="Loading containers: done."
5月 20 23:37:33 localhost.localdomain dockerd[5134]: time="2019-05-20T23:37:33.771174846+08:00" level=info msg="Docker daemon" commit=481bc77 graphdriver(s)=devicemapper version=18.09.6
5月 20 23:37:33 localhost.localdomain dockerd[5134]: time="2019-05-20T23:37:33.771611282+08:00" level=info msg="Daemon has completed initialization"
5月 20 23:37:33 localhost.localdomain dockerd[5134]: time="2019-05-20T23:37:33.933190974+08:00" level=info msg="API listen on /var/run/docker.sock"
5月 20 23:37:33 localhost.localdomain systemd[1]: Started Docker Application Container Engine.
Hint: Some lines were ellipsized, use -l to show in full.

6、运行“hello-world”镜像测试是否安装成功

[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete 
Digest: sha256:6f744a2005b12a704d2608d8070a494ad1145636eeb74a570c56b94d94ccdbfc
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/

 

posted @ 2019-05-20 23:43  你知道我不是人民币  阅读(1409)  评论(0编辑  收藏  举报