安装Docker

docker docs : https://docs.docker.com

windows

下载地址:https://store.docker.com/editions/community/docker-ce-desktop-windows

需要开启 Hyper-V

直接安装

mac

下载地址 https://store.docker.com/editions/community/docker-ce-desktop-mac

直接安装 Docker.dmg .

ubuntu

如果是新安装的建议将/etc/apt/source.list内容替换为阿里源

1
2
3
4
5
6
7
8
9
10
11
12
deb https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse


用脚本安装

1
2
3
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh

按步骤安装

安装 Docker CE 需要 64 位的 Ubuntu

删除老版本的 Docker

1
2
$ sudo apt-get remove docker docker-engine docker.io

Docker 支持 aufs

ubunut14.04 需要,16.04 不需要

1
2
3
4
5
6
7
8
9
$ sudo apt-get update

$ sudo apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual

#问题 安装后机器起Docker会死机 升级内核到4.2后问题解决
sudo apt-get install linux-generic-lts-wily

安装

update apt-get

1
2
$ sudo apt-get update

添加apt https 支持

1
2
3
4
5
6
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common

添加 Docker GPG key

1
2
3
4
5
6
7
8
9
10
11
12
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88 #验证
pub 4096R/0EBFCD88 2017-02-22
Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid Docker Release (CE deb) <[email protected]>
sub 4096R/F273FCD8 2017-02-22

$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

安装Docker-CE

1
2
3
4
$ sudo apt-get update
$ sudo apt-get install docker-ce #写文档时最新版本docker version 18.06.1-ce
# $ sudo apt-get install docker-ce=<VERSION> # 安装指定版本的docker

作者

张巍

发布于

2018-10-30

更新于

2018-10-30

许可协议

评论