运行环境
系统版本:Ubuntu 16.04.5 LTS
软件版本:Docker-CE-18.09.5
硬件配置:无
安装过程
1、卸载旧版本
root@ubuntu:~# sudo apt-get remove docker docker-engine docker.io containerd runc
2、安装依赖
root@ubuntu:~# sudo apt-get update
root@ubuntu:~# sudo apt-get -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
3、添加APT-Docker存储库
APT-Docker存储库由阿里云开源镜像网提供。
root@ubuntu:~# curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
root@ubuntu:~# sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
4、更新APT存储
root@ubuntu:~# sudo apt-get update
5、安装Docker
root@ubuntu:~# sudo apt-get -y install docker-ce-{version}
6、启动Docker服务
root@ubuntu:~# systemctl start docker
root@ubuntu:~# systemctl enable docker
root@ubuntu:~#-
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-04-23 17:41:12 CST; 1min 36s ago
7、配置Docker在线镜像源为国内镜像源
[root@localhost ~]# vim /etc/docker/daemon.json
{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
[root@localhost ~]# systemctl restart docker
8、测试运行
root@ubuntu:~# sudo docker run hello-world