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/

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM