user2882674
user2882674

Reputation: 11

Jenkins shell script execution on different server

I have two VM, on one VM I have docker and on another I have Jenkins .I have shell script for running docker, which is placed on server which have docker on it. But I need Jenkins to execute this shell script, from pre-build step.

I am facing problem with this process. It will be very helpful if any one can provide the detail steps

Thanks in Advance

Upvotes: 0

Views: 1393

Answers (2)

Damiano Ferrante
Damiano Ferrante

Reputation: 151

If your network is sufficiently secured from the outside, you could expose the docker API socket via a TCP port on your docker-machine and run the docker commands from your jenkins machine, using the remote tcp-port.

Basic idea is outlined here in the section "Bind Docker to another host/port or a Unix socket"

Cheers D

Upvotes: 1

Thomasleveil
Thomasleveil

Reputation: 104035

There are different approaches to achieve that.

One is to install Jenkins slave on the VM which has docker on and have your Jenkins master run the whole job on the slave.

Or you could install one of Publish Over SSH Plugin or SSH plugin to execute commands remotely (if your docker VM has SSH access)

Upvotes: 1

Related Questions