[英]docker: command not found ( mac mini ) only happens in jenkins shell step but work from command prompt
[英]Cannot execute a shell script with docker command from Jenkins Pipeline step
我在MacOS-HighSierra上使用帶有管道的Jenkins版本2.121.1。
我有一個名為build_docker_image.sh的shell腳本,該腳本使用以下命令構建docker映像:
docker build -t test_api:1 -f test-dockerfile
test-dockerfile是一個Dockerfile,並具有建立映像的說明。
通過CLI可以完成整個設置! 但是,當我從Jenkins服務器管道上下文運行它時,它在上一行失敗並出現錯誤:docker:command not found
從Jenkins服務器觸發的步驟很簡單。 調用腳本:
stage ('Build-Docker-Image') {
steps {
sh '/path/to/build-docker_image.sh'
}
}
在Jenkinsfile中,我確保$ PATH包含Docker的路徑。
問題是我要附加像/Applications/Docker.app/Contents/Resources/bin/docker這樣的實際docker應用程序,而不是目錄/Applications/Docker.app/Contents/Resources/bin
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.