Ubuntu下安装Docker -CE

原文地址:https://developer.aliyun.com/mirror/docker-ce?spm=a2c6h.13651102.0.0.19e21b11g8ArIA

【安装之前一定要确保服务器通网络】

安装Docker-CE

# step1: 安装必要的一些系统工具

sudo apt-get  update

sudo apt-get-y install apt-transport-https ca-certificates curl software-properties-common

# step 2: 安装GPG证书

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

curl -O https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc sudo apt-key add ros.asc

# Step 3: 写入软件源信息

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

# Step 4: 更新并安装Docker-CE

sudo apt-get -y update

sudo apt-get -y install docker-ce

# Step 5:查看版本

docker version


# Step 6: 启动docker

systemctl enable docker  //配置随机启动

systemctl start docker

安装指定版本的Docker-CE:

# Step 1: 查找Docker-CE的版本:

 apt-cache madison docker-ce

# docker-ce | 17.03.1~ce-0~ubuntu-xenial |https://mirrors.aliyun.com/docker-ce/linux/ubuntuxenial/stable amd64 Packages

# docker-ce | 17.03.0~ce-0~ubuntu-xenial |https://mirrors.aliyun.com/docker-ce/linux/ubuntuxenial/stable amd64 Packages

# Step 2: 安装指定版本的Docker-CE: (VERSION例如上面的17.03.1~ce-0~ubuntu-xenial)

 sudo apt-get-y install docker-ce=[VERSION]

方法二:

apt-get update

apt-get install -y apt-transport-https ca-certificates curl software-properties-common

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

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

apt-get update

apt-cache madison docker-ce

#安装指定版#

#apt-get install docker-ce=17.12.0~ce-0~ubuntu

#安装最新版

apt-get install docker-ce

systemctl enable docker

systemctl start docker

docker /etc/docker/daemon.json 镜像加速地址

申请阿里云镜像说明:https://zhuanlan.zhihu.com/p/466923319

官方的配置地址:https://docs.docker.com/engine/reference/commandline/dockerd/#options

配置文件的默认路径:/etc/docker/daemon.json

常用参数选项:

{

  "registry-mirrors": ["https://7uko0u1b.mirror.aliyuncs.com"], #镜像加速地址

"insecure-registries": ["registry.cn-hangzhou.aliyuncs.com"], # Docker如果需要从非SSL源管理镜像,这里加上。

  "max-concurrent-downloads": 10

}

{

"registry-mirrors": ["https://7uko0u1b.mirror.aliyuncs.com"],

"insecure-registries" : ["172.19.6.216:8443","registry.cn-hangzhou.aliyuncs.com","registry.cn-shenzheng.aliyuncs.com"]

}

重启docker

systemctl reload docker

systemctl restart docker

service docker restart

service docker  reload

你可能感兴趣的:(Ubuntu下安装Docker -CE)