Centos
# 更新
root@centos:/# yum -y update
# 添加 yum工具
root@centos:/# yum install -y yum-utils
# 添加 源路径
root@centos:/# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 下载 docker-ce
root@centos:/# yum install -y docker-ce
# 更新源
root@centos:/# mkdir /etc/docker
root@centos:/# touch /etc/docker/daemon.json
root@centos:/# echo '{"registry-mirrors": ["https://14v59lb0.mirror.aliyuncs.com"]}' /etc/docker/daemon.json
root@centos:/# systemctl restart docker
# 设置为开机启动
root@centos:/# systemctl enable docker
Ubuntu
root@ubuntu:/
root@ubuntu:/