# 阿里与服务器安装 Docker 的命令

**URL:** <https://www.isharkfly.com/t/docker/17022>\
**Category:** DevOps\
**Tags:** linux\
**Created:** [March 7, 2025, 5:22pm UTC](https://www.isharkfly.com/t/docker/17022 "2025-03-07T17:22:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hex](https://www.isharkfly.com/user_avatar/www.isharkfly.com/hex/32/21953_2.png) [@hex](https://www.isharkfly.com/u/hex)\
**Post date:** [March 7, 2025, 5:22pm UTC](https://www.isharkfly.com/t/docker/17022/1 "2025-03-07T17:22:11Z")

</div>

要在阿里的云服务器上安装 Docker ，需要使用的命令如下：

```auto
#添加Docker软件包源
sudo wget -O /etc/yum.repos.d/docker-ce.repo http://mirrors.cloud.aliyuncs.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's|https://mirrors.aliyun.com|http://mirrors.cloud.aliyuncs.com|g' /etc/yum.repos.d/docker-ce.repo
#Alibaba Cloud Linux3专用的dnf源兼容插件
sudo dnf -y install dnf-plugin-releasever-adapter --repo alinux3-plus
#安装Docker社区版本，容器运行时containerd.io，以及Docker构建和Compose插件
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
#启动Docker
sudo systemctl start docker
#设置Docker守护进程在系统启动时自动启动
sudo systemctl enable docker

```

阿里云服务器的操作系统是 Alibaba Cloud Linux 3，其实这个操作系统是基于 CentOS 的，所以 dnf 的命令都可以用。
