0%

Docker安装

Linux Ubuntu

1.安装apt-https

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

2添加PGP Key

官方库:

1
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

阿里云镜像:

1
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

3.添加源

官方源:

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

阿里云镜像:

1
2
3
4
sudo add-apt-repository \
"deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(lsb_release -cs) \
stable"

4.更新APT包索引

1
sudo apt-get update

5.安装docker引擎

1
sudo apt-get install docker-ce

6.添加用户至Docker用户组

  1. 创建docker组
    1
    sudo groupadd docker
  2. 将当前用户加入docker组:
    1
    sudo gpasswd -a ${USER} docker
  3. 刷新Docker成员:
    1
    newgrp - docker

7.配置Aliyun镜像

http://blog.csdn.net/qq_26091271/article/details/51501768

1
sudo vim /etc/docker/daemon.json
1
2
3
{
"registry-mirrors":["https://4p25zs3g.mirror.aliyuncs.com"]
}
1
sudo service docker restart