Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Jenkins Shell中运行Docker命令_Jenkins_Docker_Jenkins Plugins_Docker Compose_Docker Machine - Fatal编程技术网

在Jenkins Shell中运行Docker命令

在Jenkins Shell中运行Docker命令,jenkins,docker,jenkins-plugins,docker-compose,docker-machine,Jenkins,Docker,Jenkins Plugins,Docker Compose,Docker Machine,我试图在Jenkins Shell中运行docker命令 我正在尝试的命令shell是 # optional: record current versions of docker apps with each build docker -v && docker-compose -v && docker-machine -v # set-up: clean up any previous machine failures docker-machine stop t

我试图在Jenkins Shell中运行docker命令

我正在尝试的命令shell是

# optional: record current versions of docker apps with each build
docker -v && docker-compose -v && docker-machine -v

# set-up: clean up any previous machine failures
docker-machine stop test || echo "nothing to stop" && \
docker-machine rm test   || echo "nothing to remove"

# use docker-machine to create and configure 'test' environment
# add a -D (debug) if having issues
docker-machine create --driver virtualbox test
eval "$(docker-machine env test)"

# use docker-compose to pull and build new images and containers
docker-compose -p jenkins up -d

# optional: list machines, images, and containers
docker-machine ls && docker images && docker ps -a

# wait for containers to fully start before tests fire up
sleep 30

# test services
sh tests.sh $(docker-machine ip test)

# tear down: stop and remove 'test' environment
#docker-machine stop test && docker-machine rm test
有人知道如何设置Jenkins来运行docker命令docker、docker compose和docker machine吗

UPDATEError消息

命令docker版本

命令docker compose-v

命令docker机器-v


docker和Jenkins相处得很好

最重要的是,确保Jenkins build slave上安装了正确版本的docker和docker compose(如果需要)

确保jenkins用户是jenkins build slave上docker组的一部分


然后您可以像往常一样执行docker命令。

Jenkins安装的机器上是否已经安装了docker?你已经看过Jenkin为docker开发的插件了吗?您遇到了什么特殊问题?我在这里没有看到任何错误消息。您好@larsks,我已经添加了错误消息you's get command not found errors。您的系统没有安装Docker。@larsks,但我只有一台机器,OS X Yosemite,thas安装了Jenkins,Docker在主机虚拟箱中,可能问题是Jenkins没有连接到主机,如何设置Jenkins以通过CLI与Docker连接?如何检查Jenkits用户是否属于Docker组?sudo usermod-aG Docker Jenkins取决于操作系统-此命令需要在安装Docker的构建从机上执行OP显示机器上安装了Docker和其他命令,但在Jenkins构建作业中不可用。
Started by user anonymous
Building in workspace /Users/Shared/Jenkins/Home/jobs/Virtual-Vehicles_Docker_Machine/workspace
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/garystafford/virtual-vehicles-docker.git # timeout=10
Fetching upstream changes from https://github.com/garystafford/virtual-vehicles-docker.git
 > git --version # timeout=10
 > git -c core.askpass=true fetch --tags --progress https://github.com/garystafford/virtual-vehicles-docker.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 433683c8b9da5272b9f98c9a9653aac5bfb8c0b5 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 433683c8b9da5272b9f98c9a9653aac5bfb8c0b5
 > git rev-list 433683c8b9da5272b9f98c9a9653aac5bfb8c0b5 # timeout=10
[workspace] $ /bin/sh -xe /Users/Shared/Jenkins/tmp/hudson5615310598120649485.sh
+ docker -v
/Users/Shared/Jenkins/tmp/hudson5615310598120649485.sh: line 3: docker: command not found
+ docker-machine stop test
/Users/Shared/Jenkins/tmp/hudson5615310598120649485.sh: line 6: docker-machine: command not found
+ echo 'nothing to stop'
nothing to stop
+ docker-machine rm test
/Users/Shared/Jenkins/tmp/hudson5615310598120649485.sh: line 7: docker-machine: command not found
+ echo 'nothing to remove'
nothing to remove
+ docker-machine create --driver virtualbox test
/Users/Shared/Jenkins/tmp/hudson5615310598120649485.sh: line 11: docker-machine: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Client:
 Version:      1.10.2
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   c3959b1
 Built:        Mon Feb 22 22:37:33 2016
 OS/Arch:      darwin/amd64

Server:
 Version:      1.10.2
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   c3959b1
 Built:        Mon Feb 22 22:37:33 2016
 OS/Arch:      linux/amd64
docker-compose version 1.6.0, build d99cad6
docker-machine version 0.6.0, build e27fb87