CentOS中快速安装Docker

快速安装

1
curl -sSL https://get.docker.com/ | sh
1
curl -sSL https://get.daocloud.io/docker | sh
1
curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -

手动安装

卸载旧版本

1
2
3
4
5
6
7
8
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine

设置yum仓库

1
2
3
4
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

安装Docker引擎

注意:docker-compose-plugin即安装docker-compose,不需要再进行手动安装

1
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin

启动Docker

1
2
sudo systemctl start docker
sudo systemctl enable docker