を「許可が拒否された」私はUbuntuの14.04機械、ジェンキンスとセットアップ、Gitlabとドッキングウィンドウのランタイムがインストール上のCI環境を持っています。私は、次のターゲットの呼び出しで成る、プロジェクトmyproject-こんにちは世界(のJava/Mavenプロジェクト)と、対応するジェンキンスジョブを構成しジェンキンスジョブは次のエラーで失敗しジェンキンスは、ドッキングウィンドウプラグインジョブエラー
(in Jenkins > myproject-hello-world job configuration page)
Invoke top-level Maven targets
clean package docker:build -DskipTests
:
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.3:build (default-cli) on project myproject-hello-world:
Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException:
org.newsclub.net.unix.AFUNIXSocketException: Permission denied (socket: /run/docker.sock) -> [Help 1]
(see below for the whole console log)
メイクのためにclean package
タスクのみを残している場合(つまり、ドッキングプラグインをビルドして残りの部分を変更しない場合)、プロジェクトは問題なく構築されるため、私のJenkins + Jdk + Maven + Gitlab設定何も問題はないはずです。私は私の開発マシン上で起動している場合
また、これは正しく私のプロジェクトのためのドッキングウィンドウの画像を作成するだけでなく動作します。これにより、pom.xmlまたは私のDockerfileのdocker-mavenプラグイン設定の問題が除外されます。
これはシステム構成>クラウド/クラウドの追加> JekinsドッカープラグインはJenkinsの設定で設定されている方法です。私は、次の設定
私が何かを置く必要があるかどうかName
docker
Docker URL
http://localhost:4243
Credentials:
None
ない明確なを入れているドッカーセクションジョブ全体のコンソール出力
これは、「資格情報」セクションには、(「アクセス許可が拒否されました」エラー問題があること、関連するかもしれないが、場合には、私はここに置くべきかの資格情報のさっぱりだが)
Started by user ...
Building in workspace /var/lib/jenkins/workspace/myproject-hello-world mvn docker build
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url http://myproject.repository:8082/<my username>/myproject-hello-world.git # timeout=10
Fetching upstream changes from http://myproject.repository:8082/<my username>/myproject-hello-world.git
> git --version # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username <my username> # timeout=10
> git config --local credential.helper store --file=/tmp/git4397825852307959267.credentials # timeout=10
> git -c core.askpass=true fetch --tags --progress http://myproject.repository:8082/<my username>/myproject-hello-world.git +refs/heads/*:refs/remotes/origin/*
> git config --local --remove-section credential # 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 456503c176851863d8398df83385305687aef9b3 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 456503c176851863d8398df83385305687aef9b3
> git rev-list 456503c176851863d8398df83385305687aef9b3 # timeout=10
[myproject-hello-world mvn docker build] $ mvn clean package docker:build -DskipTests
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myproject-hello-world 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ myproject-hello-world ---
[INFO] Deleting /var/lib/jenkins/workspace/myproject-hello-world mvn docker build/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ myproject-hello-world ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myproject-hello-world ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /var/lib/jenkins/workspace/myproject-hello-world mvn docker build/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ myproject-hello-world ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/lib/jenkins/workspace/myproject-hello-world mvn docker build/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ myproject-hello-world ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /var/lib/jenkins/workspace/myproject-hello-world mvn docker build/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ myproject-hello-world ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ myproject-hello-world ---
[INFO] Building jar: /var/lib/jenkins/workspace/myproject-hello-world mvn docker build/target/myproject-hello-world.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.3.3.RELEASE:repackage (default) @ myproject-hello-world ---
[INFO]
[INFO] --- docker-maven-plugin:0.2.3:build (default-cli) @ myproject-hello-world ---
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Copying /var/lib/jenkins/workspace/myproject-hello-world mvn docker build/target/myproject-hello-world.jar -> /var/lib/jenkins/workspace/myproject-hello-world mvn docker build/target/docker/myproject-hello-world.jar
[INFO] Copying src/main/docker/Dockerfile -> /var/lib/jenkins/workspace/myproject-hello-world mvn docker build/target/docker/Dockerfile
[INFO] Building image myproject-h2020/myproject-hello-world:0.0.1-SNAPSHOT
May 10, 2016 1:34:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (org.newsclub.net.unix.AFUNIXSocketException) caught when processing request to {}->unix://localhost:80: Permission denied
May 10, 2016 1:34:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
May 10, 2016 1:34:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (org.newsclub.net.unix.AFUNIXSocketException) caught when processing request to {}->unix://localhost:80: Permission denied
May 10, 2016 1:34:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
May 10, 2016 1:34:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (org.newsclub.net.unix.AFUNIXSocketException) caught when processing request to {}->unix://localhost:80: Permission denied
May 10, 2016 1:34:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {}->unix://localhost:80
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.626s
[INFO] Finished at: Tue May 10 13:34:39 UTC 2016
[INFO] Final Memory: 27M/64M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.3:build (default-cli) on project myproject-hello-world: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.newsclub.net.unix.AFUNIXSocketException: Permission denied (socket: /run/docker.sock) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
でのドッキングウィンドウのプラグインの指示のページで
Iがある/ etc/default /ドッキングウィンドウのファイルに
DOCKER_OPTS="-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock"
を設定する必要がヒントがあります。私はそれをしたが、何も変わらなかった。 @chrxこのことにより、上述したように
ジェンキンスが動作しているユーザーとは何ですか?彼は 'ドッカー'グループの一員ですか?グループは、あなたの(通常は補助的な)グループのいずれかである必要がありdocker'ドッキングウィンドウのソケット 'に接続するために一般的に – mszymborski
。そのソケットにしかアクセスできないユーザを作成し(セキュリティ上の理由から)、プラグインの設定に自分の信用証明書を入れてもいいし、 'jenkins'ユーザをそのグループに追加する気にしなければ(これは賢明ではないでしょう、)軽く – mszymborski
おかげでそれを取るために、それは私の問題の理由のようです。 私はこのスレッドhttp://serverfault.com/questions/639459/why-might-the-jenkins-user-not-have-permission-to-access-the-docker-unix-socketも見つけました。私と同じ問題になります。 DOCKER_OPTSの=」-Gジェンキンスを直接にある/ etc/default /ドッキングウィンドウを追加することを提案し、これは実際に私の例外を排除し 。 – chrx