CentOS安装docker

安装依赖包:

$ sudo yum install -y yum-utils \
           device-mapper-persistent-data \
           lvm2

安装docker

$ sudo yum install docker

安装完成之后运行下面的命令,查看是否安装成功

docker version
or
docker info

安装成功,则提示

Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-103.git7f2769b.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7f2769b/1.13.1
 Built:           Sun Sep 15 14:06:47 2019
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-103.git7f2769b.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7f2769b/1.13.1
 Built:           Sun Sep 15 14:06:47 2019
 OS/Arch:         linux/amd64
 Experimental:    false

如果提示

Client:
 Version:         1.13.1
 API version:     1.26
 Package version:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

可能是docker没有启动造成的,运行下面的命令重启docker

sudo systemctl start docker

sudo service docker restart

启动Docker-CE

$ sudo systemctl enable docker
$ sudo systemctl start docker

除非注明,否则均为李锋镝的博客原创文章,转载必须以链接形式标明本文链接

本文链接:https://www.lifengdi.com/archives/article/1389

分享到:
订阅
提醒
guest
0 评论
Inline Feedbacks
查看所有评论