Docker Community Edition (CE)/Docker社区版非常适合希望开始使用Docker并尝试使用基于容器的应用程序的开发人员和小型团队。Docker CE有2个版本:stable and edge:
- Stable:每一个季度提供稳定的更新
- Edge:每一个月都有新的功能
以下是官网的安装文档,涉及到各种操作系统的安装方式
https://docs.docker.com/engine/installation/
本文浅尝辄止,在ubuntu14.04上安装最新版的Dokcer CE Stable,并且都是以root来运行。
===============================================
0x01 卸载以前版本&update
卸载之前版本的docker:
#如果是docker.io
apt-get remove docker.io
#如果是docker-ce
apt-get remove docker-ce
之后,更新一下总是没有错的。
apt-get update
0x02 基于deb安装包来安装docker-ce
ubuntu的docker-ce镜像:
https://download.docker.com/linux/ubuntu/dists/
(推荐国内清华源 https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/dists/ )
这里我是选择14.04(trusty)的最新版Dokcer CE Stable
https://download.docker.com/linux/ubuntu/dists/trusty/pool/stable/amd64/
这里面目前最新的是2017-09-27 01:48的docker-ce_17.09.0~ce-0~ubuntu_amd64.deb
下载后放在ubuntu目录下,运行
dpkg -i docker-ce_17.09.0~ce-~ubuntu_amd64.deb
(补充:16.04/xenial https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/
18.04/bionic https://download.docker.com/linux/ubuntu/dists/bionic/pool/stable/amd64/)
-= 2019.05补充 =-
16.04以上的docker-ce最新版本安装时报错:
docker-ce depends on docker-ce-cli
docker-ce depends on containerd.io (>= 1.2.-)
解决法子,再去其下载目录下载docker-ce-cli和containerd.io分别进行安装。
0x03 libltdl7和libsystemd-journal0依赖问题
当安装时候报错如下:
dpkg: dependency problems prevent configuration of docker-ce:
docker-ce depends on libltdl7 (>= 2.4.); however:
Package libltdl7 is not installed.
docker-ce depends on libsystemd-journal0 (>= ); however:
Package libsystemd-journal0 is not installed. dpkg: error processing package docker-ce (--install):
dependency problems - leaving unconfigured
Processing triggers for ureadahead (0.100.-) ...
ureadahead will be reprofiled on next reboot
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Errors were encountered while processing:
docker-ce
先安装libltdl7和libsystemd-journal0
apt-get install -y libltdl7 libsystemd-journal0
安装后再去安装docker-ce即可
安装好后运行docker -v,得到
Docker version 17.09.-ce, build afdb6d4
0x04 libltdl7和libseccomp2依赖问题
当安装libltdl7报错如下:
Depends: libseccomp2 (>= 2.3.) but 2.2.-3ubuntu3 is to be installed
Recommends: aufs-tools but it is not going to be installed
只需要:
apt-get install -y libltdl7 libseccomp2
0x05 缺少libltdl.so.7
报错如下:
docker: error while loading shared libraries: libltdl.so.: cannot open shared object file: No such file or directory
也是因为没安装好libltdl7
apt-get install -y libltdl7