在线安装

To install Docker Engine, you need a maintained version of CentOS 7 or 8 

参考文档 ​​https://docs.docker.com/engine/install/centos/​


  1. 准备一台centos7以上的服务器
  2. 清空环境

sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine


  3. 设置源

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


  4. 安装docker引擎

yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io
yum install docker-ce docker-ce-cli containerd.io


  5. 启动docker

systemctl start docker


  6. docker服务自启

systemctl enable docker


  7. 检查docker状态

systemctl status docker


  8. 测试docker

docker run hello-world



备注:

查看linux内核版本

uname -r

查查linux系统信息

cat /etc/os-release