虚拟机ub 安装docker
安装docker
# 1.卸载旧版本 sudo apt-get remove docker docker-engine docker.io containerd runc # 2.更新ubuntu的apt源索引 # 修改apt国内源为中科大源 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/' /etc/apt/sources.list sudo apt update # 3.安装包允许apt通过HTTPS使用仓库 sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common # 4.添加Docker官方GPG key curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # 5.设置Docker稳定版仓库(国内使用都用用国内的源) # 5.1 设置使用阿里云 add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" # 5.2 设置使用官方,很慢(不建议用这个) sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" # 6.添加仓库后,更新apt源索引 sudo apt-get update # 7.安装最新版Docker CE(社区版) sudo apt-get install docker-ce # 8.检查Docker CE是否安装正确 sudo docker run hello-world
docker 启动设置
# 启动Docker服务并设置开机启动 systemctl start docker systemctl enable docker
做最野的狼