Linux安装docker脚本
时间: 2023-05-30 08:02:44 浏览: 133
Linux_centOS7_x86_64离线自动安装docker脚本
5星 · 资源好评率100%
以下是Linux安装docker的脚本:
1. 首先,更新系统包和安装必要的工具:
```shell
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
```
2. 添加Docker的GPG秘钥:
```shell
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
```
3. 添加Docker的apt源:
```shell
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
```
4. 安装Docker:
```shell
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
```
5. 验证Docker是否安装成功:
```shell
sudo docker run hello-world
```
如果输出类似于以下内容,则说明Docker已经成功安装:
```
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
```
现在,你已经成功安装了Docker。
阅读全文