-
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 -
yum安装依赖包
# 出现超时问题, 换源 sudo yum-config-manager \ --add-repo \ https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo # 依赖包 sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2 -
安装docker-ce
sudo yum install docker-ce -
使用脚本自动化安装
curl -fsSL get.docker.com -o get-docker.sh sudo sh get-docker.sh --mirror Aliyun -
启动Docker CE
sudo systemctl enable docker sudo systemctl start docker -
建立docker组, 将当前用户加入到 docker组
sudo groupadd docker sudo usermod -aG docker $USER -
测试Docker是否安装正确
docker run hello-world # 输出下方信息, 则说明安装成功 Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:41a65640635299bab090f783209c1e3a3f11934cf7756b09cb2f1e02147c6ed8 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1\. The Docker client contacted the Docker daemon. 2\. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3\. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4\. 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 bash Share 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/