docker官网安装页面:https://docs.docker.com/engine/installation/linux/ubuntu/
这个是ubuntu14.04 LTS需要的
$ sudo apt-get update $ sudo apt-get install -y --no-install-recommends linux-image-extra-$(uname -r) linux-image-extra-virtual
下面开始安装
$ sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates curl software-properties-common
$ curl -fsSL https://apt.dockerproject.org/gpg | sudo apt-key add -
#Verify that the key ID is58118E89F3A912897C070ADBF76221572C52609D
.
$ apt-key fingerprint 58118E89F3A912897C070ADBF76221572C52609D pub 4096R/2C52609D 2015-07-14 Key fingerprint = 5811 8E89 F3A9 1289 7C07 0ADB F762 2157 2C52 609D uid Docker Release Tool (releasedocker) <docker@docker.com>
$ sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main"
$ sudo apt-get update
$ sudo apt-get -y install docker-engine
# 或者
$ sudo apt-get -y install docker-engine=<VERSION_STRING>
下面是测试是否成功
$ sudo docker run hello-world
安装成功后pull镜像会非常慢,配置加速器
$ sudo vim /lib/systemd/system/docker.service
找到
ExecStart=/usr/bin/dockerd -H fd://
修改成
ExecStart=/usr/bin/dockerd -H fd:// --registry-mirror=https://ulh1xo4t.mirror.aliyuncs.com
使配置生效
sudo systemctl daemon-reload sudo systemctl restart docker
卸载:
$ sudo apt-get purge docker-engine $ sudo rm -rf /var/lib/docker
其他编写的配置文件需要手动删除