gpt4 book ai didi

jenkins - Docker 在 Jenkins 中构建

转载 作者:行者123 更新时间:2023-12-02 21:23:35 24 4
gpt4 key购买 nike

使用 Docker 构建和发布运行作业时出现异常请在下面找到异常

git config core.sparsecheckout # timeout=10 git checkout -f 82bb778d55f0a9a5020c23aa5dfa62db79de2e28 git rev-list 82bb778d55f0a9a5020c23aa5dfa62db79de2e28 # timeout=10 [example]

$ docker build -t adithi11/demo-example:v9 --pull=true /Users/Shared/Jenkins/Home/workspace/example


ERROR: Cannot run program "docker" (in directory "/Users/Shared/Jenkins/Home/workspace/example"): error=2, No such file or directory
java.io.IOException: Cannot run program "docker" (in directory "/Users/Shared/Jenkins/Home/workspace/example"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:245)
at hudson.Proc$LocalProc.<init>(Proc.java:214)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:846)
at hudson.Launcher$ProcStarter.start(Launcher.java:384)
at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:487)
at com.cloudbees.dockerpublish.DockerBuilder$Perform.executeCmd(DockerBuilder.java:431)
at com.cloudbees.dockerpublish.DockerBuilder$Perform.buildAndTag(DockerBuilder.java:373)
at com.cloudbees.dockerpublish.DockerBuilder$Perform.exec(DockerBuilder.java:311)
at com.cloudbees.dockerpublish.DockerBuilder$Perform.access$100(DockerBuilder.java:291)
at com.cloudbees.dockerpublish.DockerBuilder.perform(DockerBuilder.java:262)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.Build$BuildExecution.build(Build.java:205)
at hudson.model.Build$BuildExecution.doRun(Build.java:162)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 19 more
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE

但是当我 sudo to jenkins 我得到了这个

须藤苏 Jenkins
docker 图像
尝试在 unix:///var/run/docker.sock 连接到 Docker 守护程序套接字时获得权限被拒绝:获取 http://%2Fvar%2Frun%2Fdocker.sock/v1.25/images/json :调用 unix/var/run/docker.sock:连接:权限被拒绝

非常感谢您的帮助

最佳答案

# Add the docker group if it doesn't already exist.
$ sudo groupadd docker

# Add jenkins user to docker group.
$ sudo gpasswd -a jenkins docker

# Restart the Docker daemon.
$ sudo service docker restart

注销并再次登录以应用更改

关于jenkins - Docker 在 Jenkins 中构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42104574/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com