阿里云linux 安装docker
时间: 2024-11-09 17:11:35 浏览: 21
阿里云Linux上安装Docker通常需要以下几个步骤:
1. **更新系统**:
```sh
sudo apt-get update
sudo apt-get upgrade
```
2. **添加官方镜像源**:
```sh
curl -fsSL https://get.docker.com | sh
```
或者
```sh
echo "deb [arch=amd64] https://mirrors.aliyun.com/docker-cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
3. **安装密钥并添加信任**:
```sh
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
```
4. **更新apt缓存并安装Docker**:
```sh
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
```
5. **启动并设置服务自动运行**:
```sh
sudo systemctl start docker
sudo systemctl enable docker
```
6. **验证安装**:
```sh
docker run hello-world
```
阅读全文