一元暴、實(shí)驗(yàn)背景
現(xiàn)在docker將版本分為企業(yè)EE版以及社區(qū)CE版掘鄙。
Docker CE 在 17.03 版本之前叫 Docker Engine胸囱,版本號(hào)范圍:?0.1.0 ~ 1.13.1。
從 17.03 版本開始新的發(fā)布方案 ( 命名變動(dòng) / 發(fā)布周期的改善 / 版本號(hào)方案變更 )棵帽。
在 2017 年 3 月 2 日, docker 團(tuán)隊(duì)宣布企業(yè)版 Docker Enterprise Edition ( EE ) 發(fā)布. 為了一致, 免費(fèi)的 Docker Engine 改名為 Docker Community Edition ( CE ), 并且采用基于時(shí)間的版本號(hào)方案. 就在這一天, Docker EE 和 Docker CE 的 17.03 版本發(fā)布, 這也是第一個(gè)采用新的版本號(hào)方案的版本熄求。
Docker CE/EE 每個(gè)季度發(fā)布一次季度版本, 也就是說每年會(huì)發(fā)布 4 個(gè)季度版本, 17.03, 17.06, 17.09, 17.12 就是 2017 年的 4 個(gè)季度版本的版本號(hào), 同時(shí) Docker CE 每個(gè)月還會(huì)發(fā)布一個(gè) EDGE 版本渣玲,比如 17.04, 17.05, 17.07, 17.08, 17.10, 17.11逗概,Docker CE 季度版本自發(fā)布后會(huì)有 4 個(gè)月的維護(hù)期。
CentOS7.x上的docker安裝忘衍,主要有兩種方式:rpm yum安裝和二進(jìn)制文件安裝逾苫,其他Linux發(fā)行版安裝方式類似。
1.Docker的rpm yum安裝需要添加docker官方枚钓,然后安裝相應(yīng)的docker社區(qū)版铅搓,如果內(nèi)網(wǎng)離線安裝的化,需要先在聯(lián)網(wǎng)機(jī)器上下載主包及其依賴搀捷,在內(nèi)網(wǎng)機(jī)器搭建本地yum源星掰,執(zhí)行安裝。
2.Docker的二進(jìn)制文件安裝就省事多了嫩舟,直接下載官方二進(jìn)制安裝包(無需編譯氢烘,解壓即用),編寫服務(wù)的啟動(dòng)腳本或者Unit文件家厌。
下面我們分別介紹兩種安裝方式播玖,感受一下安裝差異。
二饭于、Docker的yum安裝
# yum -y install? yum-utils device-mapper-persistent-data lvm2
# yum-config-manager? --add-repo? ? https://download.docker.com/linux/centos/docker-ce.repo
# yum list docker-ce? --showduplicates | sort? -r
#? yum -y install docker-ce-18.06.0.ce
# systemctl? start docker
# systemctl? status docker
# systemctl? enable? docker
# docker version
三蜀踏、Docker的二進(jìn)制安裝
下載docker二進(jìn)制安裝包
# yum? -y install? ?wget?
# wget? ?https://download.docker.com/linux/static/stable/x86_64/docker-18.06.0-ce.tgz
#? tar -zxf? ?docker-18.06.0-ce.tgz
#? ll? ?./docker
# cp ./docker/docker*? ?/usr/bin
?創(chuàng)建docker服務(wù)的unit文件
# vim ?/etc/systemd/system/docker.service
##############################################################
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
##############################################
啟動(dòng)docker服務(wù)并設(shè)為開機(jī)自
# systemctl daemon-reload
# systemctl start docker
# systemctl ?status docker
# systemctl enable docker
# docker ?info
# docker ?version
四、設(shè)置鏡像加速
#? curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
#? systemctl restart docker
五掰吕、參考
https://download.docker.com/linux/static/edge/x86_64
https://docs.docker.com/engine/reference/commandline/dockerd
https://github.com/moby/moby/releases
https://github.com/moby/moby/blob/master/contrib/init/systemd/docker.service
moby/moby
https://github.com/moby/moby/blob/master/CHANGELOG.md
Docker Engine release notes
https://docs.docker.com/release-notes/docker-engine
About Docker Engine - Community
https://docs.docker.com/install
Announcing Docker Enterprise Edition
https://blog.docker.com/2017/03/docker-enterprise-edition