mac osx jenkins和docker

时间:2018-09-07 10:03:11

标签: macos docker jenkins

我想已经回答了这个问题,但是没有一个答案对我有用

我只是运行一个测试管道脚本来从jenkins中提取一个docker镜像

pipeline {

    agent {

        docker { image 'node:7-alpine' }
    }
    stages {
        stage('Test') {
            steps {
                sh 'node --version'
            }
        }
    }

}

我收到如下所示的权限被拒绝错误

[first test] Running shell script
    + docker inspect -f . node:7-alpine

    Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/containers/node:7-alpine/json: dial unix /var/run/docker.sock: connect: permission denied
    [Pipeline] sh
    [first test] Running shell script
    + docker pull node:7-alpine
    Warning: failed to get default registry endpoint from daemon (Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/info: dial unix /var/run/docker.sock: connect: permission denied). Using system default: https://index.docker.io/v1/
    Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.38/images/create?fromImage=node&tag=7-alpine: dial unix /var/run/docker.sock: connect: permission denied
    [Pipeline] }
    [Pipeline] // node
    [Pipeline] End of Pipeline
    ERROR: script returned exit code 1
    Finished: FAILURE

这是尽管已将jenkins用户添加到人员组

dscacheutil -q group -a name  staff
name: staff
password: *
gid: 20
users: root user jenkins 

我什至只允许所有人拥有权利

rwxr-xr-x 1个用户人员73 Sep 3 11:17 /var/run/docker.sock

请帮助

0 个答案:

没有答案