首先我们要知道 aliyun linux 是基于 CentOS 上进行改造的,所以应安装 在CentOS 上的安装方式进行安装
1, 查看是否安装 yum:
yum --version
2,如果之前的版本,则卸载:
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
3,我们选择 Install using the repository 的安装方式
// 首先安装 yum-utils
sudo yum install -y yum-utils
// 配置仓库
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
/**
Docker Engine has three types of update channels, stable, test, and nightly:
The Stable channel gives you latest releases for general availability.
The Test channel gives pre-releases that are ready for testing before general availability (GA).
The Nightly channel gives you latest builds of work in progress for the next major release.
**/
// 以上的内容翻译过来会变味。大概意思就是说 docker engine 有三种更新模式,stable,test,nightly
//安装时不做修改
4,安装 docker
// 我们这里选择安装最新版
sudo yum install docker-ce docker-ce-cli containerd.io
// 如果有特殊版本选择要求,先查看,再安装
// 查看:
/**
$ yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable
docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable
docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable
**/
// 安装
/**
例如:
sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
**/
5,启动 Docker:
systemctl start docker
6,查看Docker
docker --version
卸载
yum remove docker-ce docker-ce-cli containerd.io //卸载
rm -rf /var/lib/docker // Images, containers, volumes, or customized configuration files on your host are not automatically removed.