Docker Ubuntu16+安装

1.删除旧版本

sudo  apt-get remove docker  docker-engine  docker.io

2.安装 HTTPSCA 支持套件

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

3.添加 GPG 密钥

curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg |sudo apt-key add -

4.向 source.list 添加 Docker 软件源

// 学习
sudo  add-apt-repository  "deb  [arch=amd64]  https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable "

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

5.更新 apt 缓存

apt-get update
apt-get install docker-ce

测试环境下可以使用官方提供的脚本安装
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun

6.启动 Docker CE

systemctl enable docker
systemctl start docker

7.建立 Docker 用户组

docker 使用 Unix scokerDocker 引擎通讯, 而只有 root 用户和 docker 组用户才可以访问。

sudo groupadd docker

8.将当前用户加入 docker

sudo usermod -aG docker $USER

9.测试 Docker 安装是否正确

sudo docker run hello-world

10.配置加速镜像

/etc/docker/daemon.json 中写入内容,没有则新建:

{
	"registry-mirrors": [
		"https://registry.docker-cn.com"
	]
}

11.重启

sudo systemctl daemon-reload
sudo systemctl restart docker

[1] Docker 官方文档

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值