Docker支持以下版本的CentOS:
目前,CentOS 仅发行版本中的内核支持 Docker
Docker 要求 CentOS 系统的内核版本高于 3.10 ,在终端中通过 uname -r
命令查看你当前的内核版本
如果不确定当前系统是否安装了Docker则可以使用以下命令来执行检查并清理旧版本
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
$ sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
$ sudo yum makecache fast
$ sudo yum -y install docker-ce
$ sudo systemctl start docker
docker --version
查看docker的版本运行docker run hello-world
来运行测试镜像,出现如下内容则安装成功
Hello from Docker!
This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:
- The Docker client contacted the Docker daemon.
- The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)- The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.- The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/For more examples and ideas, visit:
https://docs.docker.com/get-started/
$ sudo -s
password:
$ sudo yum update
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
$ sudo systemctl start docker
$ sudo docker run hello-world
鉴于国内网络问题,后续拉取 Docker 镜像十分缓慢,我们需要配置加速器来解决,我使用的是中科大的镜像源,具体配置方法请查看官方说明:http://mirrors.ustc.edu.cn/help/dockerhub.html
—— 评论区 ——