1. 程式人生 > >[TimLinux] docker CentOS7安裝docker-ce最新版

[TimLinux] docker CentOS7安裝docker-ce最新版

device aliyun red containe b- 希望 amd ont hello

1. 環境

$ lsb_release -a  # 需要安裝 redhat-lsb-core 包
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.5.1804 (Core) 
Release: 7.5.1804
Codename: Core

2. 安裝docker-ce

1. 移除舊版本:
yum remove docker                   docker-client                   docker
-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine 2. 安裝系統工具 yum install -y yum-utils device-mapper-persistent-data lvm2
3. 添加軟件源 yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 4. 更新 yum 緩存 yum makecache fast 5. 安裝docker-ce yum -y install docker-ce 6. 啟動服務 systemctl enable docker.service systemctl start docker.service
systemctl status docker.service

● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2019-02-19 14:32:54 CST; 15min ago
Docs: https://docs.docker.com
Main PID: 30656 (dockerd)
Tasks: 20
Memory: 58.1M
CGroup: /system.slice/docker.service
├─30656 /usr/bin/dockerd -H fd://
└─30660 containerd --config /var/run/docker/containerd/containerd.toml --log-level info

Feb 19 14:32:54 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:32:54.562741035+08:00" level=info msg="Docker daemon" commit=62...18.09.2
Feb 19 14:32:54 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:32:54.562856673+08:00" level=info msg="Daemon has completed ini...zation"
Feb 19 14:32:54 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:32:54.600567389+08:00" level=info msg="API listen on /var/run/d...r.sock"
Feb 19 14:32:54 VM_0_7_centos systemd[1]: Started Docker Application Container Engine.
Feb 19 14:33:19 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:33:19.281603981+08:00" level=info msg="shim containerd-shim sta...d=30841
Feb 19 14:33:19 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:33:19.638873050+08:00" level=info msg="shim reaped" id=ebf4c60d...3e8f83a
Feb 19 14:33:19 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:33:19.648960086+08:00" level=info msg="ignoring event" module=l...Delete"
Feb 19 14:43:24 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:43:24.662160874+08:00" level=info msg="shim containerd-shim sta...d=31842
Feb 19 14:43:25 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:43:25.061068379+08:00" level=info msg="shim reaped" id=f70bd83d...edcba6a
Feb 19 14:43:25 VM_0_7_centos dockerd[30656]: time="2019-02-19T14:43:25.071236528+08:00" level=info msg="ignoring event" module=l...Delete"
Hint: Some lines were ellipsized, use -l to show in full.

7. 驗證
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/

3. 卸載 docker-ce

yum remove docker-ce
rm -rf /var/lib/docker

4. 推薦

在安裝過程中,因為要聯網,我的作法是申請了一臺免費的騰訊雲機器,第一次註冊的新用戶有15天的免費試用權,希望能夠完成多數docker相關任務的研究工作。

[TimLinux] docker CentOS7安裝docker-ce最新版