安装Docker
执行如下命令即可进行安装:
curl -fsSL https://get.docker.com/ | sh
安装完成之后会有一个提示:
就是当要以非 root 用户可以直接运行 docker 时,需要执行 sudo usermod -aG docker zhangsf
命令,然后重新登陆
此时再次登陆执行还是会报错 “Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?”
问题原因是因为docker服务没有启动,所以在相应的/var/run/
路径下找不到docker的进程。
启动Docker服务
执行 service docker start
命令,启动docker服务(如上图所示)
启动Docker的hello-world
从Docker Hub下载一个hello-world镜像
docker pull hello-world
运行hello-world镜像
docker run hello-word
This message shows that your installation appears to be working correctly.
ok!!!!