# Ubuntu上的安装Docker

> 来源：梦飞idc云平台 | 原文：https://www.mfisp.com/17806.html | 发布：2023-03-03 | 更新：2023-03-03 | 分类：建站教程、投稿分享

**1. 更新系统里的所有能更新的软件，更新apt软件包索引并安装软件包，以允许apt通过HTTPS使用存储库**

 

**lizhichao@chaochao:~$ sudo apt-get update  
lizhichao@chaochao:~$ sudo apt-get install \  
> apt-transport-https \  
> ca-certificates \  
> curl \  
> gnupg \  
> lsb-release**

 

**2. 添加Docker的官方GPG密钥**

 

**lizhichao@chaochao:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg**

 

**3.lizhichao@chaochao:~$ echo \  
 > "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \  
 > $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null**

 

**4. 更新apt软件包索引，并安装最新版本的Docker Engine和containerd，或转至下一步安装特定版本  
 lizhichao@chaochao:~$ sudo apt-get update  
lizhichao@chaochao:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io**

 

**5. 要安装特定版本的Docker Engine**

 

**lizhichao@chaochao:~$ systemctl start docker  
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===  
Authentication is required to start 'docker.service'.  
Authenticating as: repchaochao (lizhichao)  
Password:   
==== AUTHENTICATION COMPLETE ===  
lizhichao@chaochao:~$ sudo docker run hello-world**

---
本页由 梦飞idc云平台（https://www.mfisp.com）提供。站点导航见 https://www.mfisp.com/llms.txt
