在unbuntu中安装docker
时间: 2024-01-03 19:05:30 浏览: 42
您好!感谢您的提问。关于在Ubuntu中安装Docker,可以参考以下步骤:
1. 更新apt包索引:
sudo apt update
2. 安装依赖包,使apt能够通过HTTPS使用存储库:
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
3. 使用官方GPG密钥添加Docker存储库的签名:
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包索引:
sudo apt update
6. 安装最新版本的Docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io
安装完成后,可以运行以下命令检查Docker是否已正确安装:
sudo docker run hello-world
如果Docker能够正常运行并输出“Hello from Docker!”的信息,则说明安装成功。希望能帮到您。如果还有其他问题,请随时提问。
相关问题
如何在ubuntu中安装docker
在Ubuntu中安装Docker可以按照以下步骤进行:
1. 更新APT软件源:
sudo apt-get update
2. 安装依赖包:
sudo apt-get install apt-transport-https ca-certificates curl 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软件源:
sudo apt-get update
6. 安装Docker:
sudo apt-get install docker-ce
7. 验证Docker是否安装成功:
sudo docker run hello-world
以上就是在Ubuntu中安装Docker的步骤。
如何在ubuntu中安装docker并在docker中pull pytorch的镜像并运行
在 Ubuntu 中安装 Docker 可以按照以下步骤进行操作:
1. 卸载已经安装的 Docker:
```
sudo apt-get remove docker docker-engine docker.io containerd runc
```
2. 更新 apt 包:
```
sudo apt-get update
```
3. 安装 Docker 的依赖项:
```
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
```
4. 添加 Docker GPG 密钥:
```
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
```
5. 添加 Docker 软件仓库:
```
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
```
6. 更新 apt 包:
```
sudo apt-get update
```
7. 安装 Docker:
```
sudo apt-get install docker-ce docker-ce-cli containerd.io
```
8. 验证 Docker 是否正确安装:
```
sudo docker run hello-world
```
在 Docker 中运行 PyTorch 镜像,可以按照以下步骤进行操作:
1. 拉取 PyTorch 镜像:
```
sudo docker pull pytorch/pytorch
```
2. 运行 PyTorch 镜像:
```
sudo docker run --name pytorch_cont -it pytorch/pytorch
```
在运行 PyTorch 镜像时,可以加入参数进行端口映射等操作。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)