Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jenkins无法使用docker:无法连接到docker守护进程_Docker_Jenkins_Kubernetes_Kubernetes Helm_Cloudbees - Fatal编程技术网

Jenkins无法使用docker:无法连接到docker守护进程

Jenkins无法使用docker:无法连接到docker守护进程,docker,jenkins,kubernetes,kubernetes-helm,cloudbees,Docker,Jenkins,Kubernetes,Kubernetes Helm,Cloudbees,我已经通过helm在我的k8s集群中安装了jenkins。 我一直在尝试构建docker映像,并将其推送到gitlab注册表,以便稍后通过cloudbees docker插件进行部署,但我一直遇到此错误此错误: Started by user admin Running as SYSTEM Building in workspace /var/jenkins_home/workspace/Build using credential gitlab > git rev-parse -

我已经通过helm在我的k8s集群中安装了jenkins。 我一直在尝试构建docker映像,并将其推送到gitlab注册表,以便稍后通过cloudbees docker插件进行部署,但我一直遇到此错误此错误:

   Started by user admin
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/Build
using credential gitlab
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://gitlab.com/Ferios08/letsdevops-angular.git # timeout=10
Fetching upstream changes from https://gitlab.com/Ferios08/letsdevops-angular.git
 > git --version # timeout=10
using GIT_ASKPASS to set credentials gitlab
 > git fetch --tags --progress -- https://gitlab.com/Ferios08/letsdevops-angular.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision bbfedaeb976edde010c496c63de43ec01184011e (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f bbfedaeb976edde010c496c63de43ec01184011e # timeout=10
Commit message: "fixed deploy"
 > git rev-list --no-walk bbfedaeb976edde010c496c63de43ec01184011e # timeout=10
[Build] $ /var/jenkins_home/tools/org.jenkinsci.plugins.docker.commons.tools.DockerTool/docker/bin/docker build -t registry.gitlab.com/ferios08/letsdevops-angular --pull=true /var/jenkins_home/workspace/Build
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE

有没有办法解决这个问题?谢谢

在我看来,您的docker守护程序没有运行。

您正在尝试连接容器内的docker守护程序,但容器内的docker守护程序没有运行

有几种可能性:

  • 你可以跑

  • 您可以使用-v将集群的docker套接字绑定到容器

  • docker-run-v/var/run/docker.sock:/var/run/docker.sock

  • 您可以使用(docker版本>=19.03)将容器内的docker连接到某个远程docker套接字

  • 您可以在集群之外安装jenkins


  • 尝试运行
    sudo
    您无法说明您的头盔图表是否包含将主机的
    /var/run/docker.sock
    暴露到Pod的
    卷:主机路径:
    ;您实际上没有指定有关安装的任何内容,如果我们是通灵的,请提供您进入此阶段所做的步骤。抱歉,延迟回复:我已使用helm在k8s集群中安装Jenkins,通过此问题,Jenkins没有使用docker的权限,我无法改变事实,我认为它没有安装在单独的机器上。当我单独安装Jenkins时,当我使用sudo usermod-aG docker Jenkins时,它可以工作Kubernetes集群是如何创建的?裸机,GKE,AKS,EKS?@Jakub我不能在k8sit上用sudo和jenkins一起玩更多关于许可的内容怎么会?很明显,您的服务没有运行,或者没有打开任何文件供IPC使用,或者用于确定它是否正在运行(即sock/run)。当在集群外安装Jenkins并键入
    sudo usermod-aG docker Jenkins
    以授予其使用docker的权限时,它工作正常。