CentOS7 安装 docker
记录一下使用脚本自动安装docker
docker官方为了简化安装流程,提供了一条便捷的安装脚本,centos上可以使用这套脚本安装
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh --mirror Aliyun
安装完成后,可以使用
docker version
命令查看docker版本,
但是也有可能出现只看见客户端而看不到服务端的情况:
[root@localhost ~]# docker version
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:27:04 2020
OS/Arch: linux/amd64
Experimental: false
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
不必担心,使用以下命令重启下docker就好,我就是这么做的
systemctl daemon-reload
sudo service docker restart
然后看一下docker启动状态
[root@localhost ~]# sudo service docker status
Redirecting to /bin/systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: **active (running)** since 六 2020-03-14 14:55:05 CST; 14s ago
Docs: https://docs.docker.com
Main PID: 1466 (dockerd)
Tasks: 8
Memory: 44.9M
CGroup: /system.slice/docker.service
└─1466 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
表示docker启动成功,再看下docker版本
[root@localhost ~]# docker version
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:27:04 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:25:42 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
docker安装成功!