docker官网:https://docs.docker.com/engine/install/ubuntu/
Ubuntu安装Docker步骤: # 卸载旧版本 sudo apt-get remove docker docker-engine docker.io containerd runc # 更新数据源 sudo apt-get update # 安装所需依赖 sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common # 安装 GPG 证书 sudo curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - # 新增数据源 sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" # 更新并安装 Docker CE sudo apt-get update && sudo apt-get install -y docker-ce #配置Docker镜像加速器:阿里云加速器 https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'{
"registry-mirrors": ["https://registry.docker-cn.com"]
} EOF sudo systemctl daemon-reload sudo systemctl restart docker