当前位置:   article > 正文

linux/虚拟机启动docker或运行docker命令报错_redirecting to /bin/systemctl start docker.service

redirecting to /bin/systemctl start docker.service job for docker.service fa

在虚拟机yum安装docker之后,执行docker命令时报错:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
然后启动docker时:

service docker start
  • 1

报错:

Redirecting to /bin/systemctl start  docker.service
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
  • 1
  • 2

根据报错提示运行:systemctl status docker.service

systemctl status docker.service
  • 1

其中有一条报错信息:

Error starting daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid
  • 1

启动守护程序时出错:找到pid文件,请确保docker未运行或删除/var/run/docker.pid
经过各种百度搜索及修改,再执行

systemctl status docker.service
  • 1

的时候,报错变成

Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. E...d=false)
  • 1

大概意思是:此linux的内核中的SELinux不支持 overlay2 graph driver ,
解决方法有两个,要么启动一个新内核,要么就在docker里禁用selinux,
可以重新编译/etc/sysconfig/docker配置文件将–selinux-enabled改成–selinux-enabled=false

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi
  • 1
  • 2
  • 3
  • 4
  • 5

改完后

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi
  • 1
  • 2
  • 3
  • 4
  • 5

再执行docker命令即可正确运行

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/176644
推荐阅读
相关标签
  

闽ICP备14008679号