ubuntu linux安装docker
时间: 2023-11-12 09:06:28 浏览: 161
ubuntu安装docker
5星 · 资源好评率100%
安装Docker需要以下步骤:
1. 卸载旧版本的Docker(如果有):sudo apt-get remove docker docker-engine docker.io containerd runc
2. 更新apt包索引并安装依赖包:sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
3. 添加Docker的官方GPG密钥:curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
4. 添加Docker的稳定版源:sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
5. 再次更新apt包索引并安装Docker:sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli containerd.io
6. (可选)添加阿里云镜像源以加速拉取镜像:sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - && sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
7. (可选)安装Docker Compose:sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
阅读全文