docker:找不到命令(mac mini)仅在jenkins shell步骤中发生,但可在命令提示符下工作 [英] docker: command not found ( mac mini ) only happens in jenkins shell step but work from command prompt

查看:266
本文介绍了docker:找不到命令(mac mini)仅在jenkins shell步骤中发生,但可在命令提示符下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正面临着这个奇怪的问题,近两天来一直在努力解决.

I'm facing this weird problem , struggling to solve since almost couple of days.

工作: 在mac mini命令提示符下,我切换到jenkins用户,可以运行docker命令而没有任何问题.

Working: On mac mini command prompt , I switch to jenkins user and can run docker command without any problem.

不起作用: 但是当我运行jenkins作业时,无法识别shell命令步骤docker内部.

Not Working: but when I run a jenkins job , inside shell command step docker is not recognized.

我遇到错误

docker: command not found

docker --version

但是提到docker的显式路径确实有效

But mentioning explicit path of docker , does work

/Users/buildserver/Library/Group\ Containers/group.com.docker/bin/docker --version

问题:为什么docker命令无法查看正确的路径?

Question : Why docker command can't look into correct path ?

权限

lrwxr-xr-x 1个buildserver人员71 Oct 14 10:44 docker->/Users/buildserver/Library/Group Containers/group.com.docker/bin/docker

lrwxr-xr-x 1 buildserver staff 71 Oct 14 10:44 docker -> /Users/buildserver/Library/Group Containers/group.com.docker/bin/docker

jenkins的使用是工作人员小组的一部分.

jenkins uses is part of staff group.

谢谢.

关于, 维克拉姆

推荐答案

Jenkins作业开始的PATH与Jenkins用户在bash中看到的路径不同.在Jenkins UI中,您可以编辑环境变量(来自Manage Jenkins/Configure System),并将Docker文件夹添加到PATH:

The PATH which Jenkins jobs start with isn't the same as the path which the Jenkins user sees in bash. In the Jenkins UI you can edit the environment varables (from Manage Jenkins/Configure System), and add the Docker folder to PATH:

PATH -> $PATH:/Users/buildserver/Library/Group\ Containers/group.com.docker/bin/

有关此问题的答案中有更多详细信息.

Some more detail in the answer to this question.

这篇关于docker:找不到命令(mac mini)仅在jenkins shell步骤中发生,但可在命令提示符下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆