码迷,mamicode.com
首页 > 系统相关 > 详细

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

时间:2019-02-19 15:01:45      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:list   mit   工具   flow   man   研究   inf   ted   logrotate   

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最新版

标签:list   mit   工具   flow   man   研究   inf   ted   logrotate   

原文地址:https://www.cnblogs.com/timlinux/p/10400991.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!