CentOS安装docker

2019年10月25日 1586点热度 0人点赞 0条评论

安装依赖包:

$ 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
guest
0 评论
Inline Feedbacks
查看所有评论