跳转至

CentOS 7 部署 Docker引擎


2016-08-24 by dongnan

注意,文章部分信息过时,推荐使用 Ubuntu Server 系列操作系统,请参考这里,推荐原因请参考下面文章。

环境

cat /etc/centos-release
CentOS Linux release 7.2.1511 (Core)

目标

  • centos 7 安装 docker 1.12.x

步骤

安装请参考:https://docs.docker.com/engine/install/centos/

验证

查看 docker 版本信息

# 执行命令
docker version

Client:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        
 OS/Arch:      linux/amd64

升级为Docker-CE社区版本

Docker 版本升级到 docker-ce-17.09,以符合 rancher 1.6 要求。

环境

CentOS  7.4 amd64
Docker: 17.05.0-ce

步骤

获得最新源配置文件

yum-config-manager --add-repo  https://download.docker.com/linux/centos/docker-ce.repo

升级命令

yum install docker-ce

http://archive.zongming.net/attachment/thumb/1710/thread/64_2_4eaf4138657fc79.png

验证 docker版本

docker version  | awk '/Version/'
 Version:      17.09.0-ce
 Version:      17.09.0-ce

推荐使用Ubuntu操作系统

Docker 推荐使用 overlay2 存储驱动, overlay2 是目前 Docker 默认的存储驱动,以前则是 aufs ,原文如下:

Docker CE on Ubuntu supports overlay2 and aufs storage drivers.

For new installations on version 4 and higher of the Linux kernel, overlay2 is supported and preferred over aufs.
For version 3 of the Linux kernel, aufs is supported because overlay or overlay2 drivers are not supported by that kernel version.

If you need to use aufs, you need to do additional preparation as outlined below.

CentOS存储驱动

查看CentOS存储驱动。

# 执行命令
docker info

#...省略
Server Version: 1.13.1
Storage Driver: devicemapper
 Pool Name: docker-253:0-51037912-pool
#...省略
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.135-RHEL7 (2016-11-16)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
#...省略
Kernel Version: 3.10.0-514.6.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
#...省略

Ubuntu存储驱动

查看Ubuntu存储驱动。

# 执行命令
docker info

#...省略
Server Version: 17.12.1-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
#...省略
Kernel Version: 4.4.0-119-generic
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
#...省略

参考

回到页面顶部