Docker 要求CentOS 系统的内核版本高于 3.10
-
uname -r 查看内核
[root@ronnie ~]# uname -r 3.10.0-957.el7.x86_64
安装步骤
-
更新yum
yum update -y
-
如果提示: Another app is currently holding the yum lock; waiting for it to exit.
-
可能是系统自动升级正在运行, yum处于锁定状态中。
-
可以通过强制关闭yum进程来解决
rm -f /var/run/yum.pid
-
-
-
执行docker安装脚本
curl -sSL https://get.docker.com/ | sh
-
启动docker服务
[root@ronnie ~]# service docker start Redirecting to /bin/systemctl start docker.service
-
拉取hello-world测试安装是否完成
docker run hello-world
Redirecting to /bin/systemctl start docker.service [root@ronnie ~]# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:4df8ca8a7e309c256d60d7971ea14c27672fc0d10c5f303856d7bc48f8cc17ff 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/
-
查看docker版本
[root@ronnie ~]# docker version Client: Docker Engine - Community Version: 19.03.5 API version: 1.40 Go version: go1.12.12 Git commit: 633a0ea Built: Wed Nov 13 07:25:41 2019 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 19.03.5 API version: 1.40 (minimum version 1.12) Go version: go1.12.12 Git commit: 633a0ea Built: Wed Nov 13 07:24:18 2019 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.10 GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339 runc: Version: 1.0.0-rc8+dev GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 docker-init: Version: 0.18.0 GitCommit: fec3683
-
安装docker compose
-
安装epel-release依赖
yum -y install epel-release
-
安装pip包
yum -y install python-pip
-
升级pip组件
sudo pip install --upgrade pip
-
查看pip环境
[root@ronnie ~]# pip -V pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
-
安装Docker-Compose:
pip install docker-compose--ignore-installed requests
-