question:
We're trying to use the docker-build-publish plugin to create a docker image from a Docker file. We're hitting an issue with permissions against the docker service:
Started by an SCM change [EnvInject] - Loading node environment variables. Building in workspace /var/lib/jenkins/jenkins-data/jobs/Web Docker Build/workspace > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url git@github.com:apptentive/web.git # timeout=10 Fetching upstream changes from git@github.com:apptentive/web.git > git --version # timeout=10 > git fetch --tags --progress git@github.com:apptentive/web.git +refs/heads/*:refs/remotes/origin/* > git rev-parse origin/master^{commit} # timeout=10 Checking out Revision 4524d546bff7c10f7255a3b04f010af45edff98c (origin/master) > git config core.sparsecheckout # timeout=10 > git checkout -f 4524d546bff7c10f7255a3b04f010af45edff98c > git rev-list c585ab3d0a9b7dae3ce86ca8e44c6b393836c886 # timeout=10 No credentials provided, so not logging in to the registry. [workspace] $ docker build -t quay.io/apptentive/web:4524d546bff7c10f7255a3b04f010af45edff98c support/web-base 2014/08/19 23:39:40 Post http:///var/run/docker.sock/build?rm=1&t=quay.io%2Fapptentive%2Fweb%3A4524d546bff7c10f7255a3b04f010af45edff98c: dial unix /var/run/docker.sock: permission denied Build step 'Docker build and publish' marked build as failure Finished: FAILURE
We have other jenkins jobs that hit docker on this machine (without sudo) without issue-- the jenkins user is a member of the docker group and the docker group has r/w permissions on the socket.
effective answer:
I had the same issue, as described earlier, that docker container was successfully running under 'su - jenkins' but failed when executing by script build step.
Versions:
jenkins: 1.555
os: CentOS release 6.6 (Final)
docker: Docker version 1.3.2, build 39fa2fa/1.3.2
I found a work-around, that probably can be helpful to further clarify the issue.
In order to allow jenkins to create and manage docker containers via 'execute script' build step, you can configure docker service to apply 'jenkins' group ownership to the socket, rather than adding jenkins user to the default-used 'docker' group.
This configuration can be achieved by adding the '-G jenkins' arguments to the docker service config file.
For example, on centos6, I updated the following file:
cat /etc/sysconfig/docker # Docker Upstart and SysVinit configuration file # Customize location of Docker binary (especially for development testing). DOCKER="/usr/bin/docker" 0 # Use DOCKER_OPTS to modify the daemon startup options. DOCKER_OPTS=' --host=unix:///var/run/docker.sock --restart=false -g /opt/app/jenkins/docker -G jenkins' and it resulted to the following permissions: srw-rw---- 1 root jenkins 0 Jan 5 12:22 docker.sock
相关推荐
jenkins教程+docker容器实际项目实战教程.pdf jenkins教程+docker容器实际项目实战教程.pdf
使用 Docker 安装 Jenkins,可以使用以下命令:docker run --name jenkins -u root --rm -d -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock ...
Gitllab+Jenkins+Docker+Harbor 自动化部署流程 一、 版本控制系统 Gitllab Gitllab 是一个基于 web 的 Git 仓库管理系统,提供了一个强大且灵活的平台来管理 Git 项目。 Gitllab 允许用户创建、管理和共享 Git ...
项目基本结构是SpringBoot,集成了docker-maven插件实现build完的镜像上传到私服,然后用 Jenkins构建实现docker集群一键自动化部署
基于Jenkins+Gitlab+Docker实现SpringBoot项目自动部署 本文主要介绍了基于Jenkins、Gitlab和Docker实现SpringBoot项目自动部署的方法。下面将从Jenkins的安装、配置到自动化构建和部署的整个过程进行详细说明。 ...
1)根据官方链接操作即可: ... -v /var/run/docker.sock:/var/run/docker.sock \ jenkinsci/blueocean 2)容器部署完成之后,登录页面http://虚拟机的IP:18080 进入容器查看密码: 输入密码开始按照提
jenkins部署包 docker image
jenkins-pipeline-docker, 带有Jenkins管道插件和 Docker的容器构建环境 采用Jenkins管道插件和 Docker的容器环境。这里代码与这里博客帖子相关:...
触发jenkins自动pull代码,通过maven编译、打包,然后通过执行shell脚本使docker构建镜像并push到私服(或者阿里云)仓库,此操作完成后jenkins服务器上再执行SSH命令登录到部署服务器,docker从仓库(私服)拉取...
Jenkins mavn git docker-compose swarm 构建持续集成及一键式部署
Docker中的Jenkins附加了本地Docker注册表目的如果您在PC上使用Jenkins,您很可能会注意到启动后运行第一次Jenkins作业所花费的时间。 在此期间,Jenkins中的Docker提取在Jenkins文件中指定的映像。 每次Docker Dind...
Jenkins Docker and DevOps The Innovation Catalysts,Jenkins Docker and DevOps The Innovation Catalysts
基于GitLab+Jenkins与Docker的自动化考试系统后端源码.zip 特性 [x] 使用通用的Git协议 [x] 自动化测试,实时展示成绩 [x] 完全隐藏GitLab和Jenkins [x] Docker中运行测试,隔离网络 [x] CPU、内存资源限制 [ ] LDAP...
##背景:jenkins部署在容器中,无法利用docker执行操作,通过ssh将jar包和当前路径下的dockerfile推送到指定服务器目录上,使用脚本进行构
详细讲解Jenkins 结合Docker的 持续集成方案,包含大量的实践案例,适合项目发布人员和配管人员学习。
gitlab+jenkins+docker自动化部署脚本,采用shell与python开发,其中python部分均为封装成型的逻辑,只接受shell传参就能完成项目构建
Docker 安装 Jenkins 部署并自动化打包部署 Java 服务 一、 Docker 安装 Jenkins 部署 Docker 是一个开源的容器化平台,可以轻松地将应用程序打包、部署和管理。Jenkins 是一个流行的自动化构建工具,可以自动化...
Ansible-Docker-Jenkins使用 部署Jenkins Docker容器的角色。执照根据MIT许可获得许可(请参阅LICENSE文件)。作者
通过Jenkins完成docker的容器升级,镜像打包,上传仓库
带有Docker-in-Docker的Jenkins带有Docker-in-Docker的Jenkins容器映像是同时包含Jenkins和Docker-in-Docker的标准化连续集成环境。 这意味着它具有易于运输的Docker容器的所有优点,此外还具有从内部构建Docker容器...