So I have setup up two Ubuntu AWS Instances (a small t2.medium and a big r3.large). The t2.medium has Jenkins CI installed on it and the r3.large has docker engine installed on it. The intention here is to have a Master (t2.medium) server and a Slave (r3.large) server; where the master server can delegate docker containers for jobs (spin up jenkins docker containers as needed).

My problem is that I'm kinda way over my head with this one. I've been researching around but almost anything I do fails on me.

My current situation is: Like I've mentioned above, I have jenkins successfully running on one instance, and docker engine successfully running on the other. I also have the docker plugin, found here, installed on jenkins and I have followed the instructions that are on that page to the teeth. However, when I add a cloud and add credentials the only thing that's showing is "-none-"; however that same credentials shows up at the bottom.

Here's a screenshot of what I'm talking about: enter image description here

The problem with this is that every time I test the connection I get the following error:

shaded.org.apache.http.conn.HttpHostConnectException: Connect to [/] failed: Connection refused.

Any help would be much appreciated! I've been going at this for more than a week! And I'm just not able to wrap my head around this.

EDIT: If I'm going about it the wrong way, please do guide me on how to achieve the intended setup.

EDIT2: All ports are opened between those two instances.

Here's a screenshot of the security group: enter image description here

EDIT3: Here are my docker images:

ubuntu@ip-10-96-24-240:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
ubuntu@ip-10-96-24-240:~$ docker images
REPOSITORY             TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
jenkins-1              latest              9de6ee8eeebc        3 days ago          816.3 MB
ubuntu                 latest              8251da35e7a7        2 weeks ago         188.4 MB
jenkins                latest              0c79d0a394dc        3 weeks ago         888 MB
evarga/jenkins-slave   latest              8880612971b0        8 months ago        610.8 MB
  • maybe a silly comment, but just to be sure: did you open the security groups for port 4243? – Tom Aug 24 '15 at 15:09
  • Thanks for asking, I forgot to mention that. Yes, all ports are open between those instances. – Fadi Aug 24 '15 at 15:21
  • are you able to run a docker container without jenkins? – c4urself Aug 24 '15 at 15:37
  • Yes, I am able to do so. And the way I've done it is through doing an SSH into the slave server. – Fadi Aug 24 '15 at 15:49

Ok so this doesn't fully satisfy my problem, however it is a viable answer to the shaded.org.apache.http.conn.HttpHostConnectException: Connect to [/] failed: Connection refused problem. My problem was that I didn't add the following code to /etc/init/docker.conf:

description     "Docker daemon"

start on filesystem and started lxc-net
stop on runlevel [!2345]


    /usr/bin/docker -H tcp:// -d
end script

I also put 1.8.1 for the Docker Version which is the client version. Instead it should be the API version which is currently 1.20.

I hope this helps any beginner like me. :)

EDIT: Docker conf file has changed a little bit since I've posted this, here's how my docker.conf looks like now:

pre-start script
        # see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount
        if grep -v '^#' /etc/fstab | grep -q cgroup \
                || [ ! -e /proc/cgroups ] \
                || [ ! -d /sys/fs/cgroup ]; then
                exit 0
        if ! mountpoint -q /sys/fs/cgroup; then
                mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
                cd /sys/fs/cgroup
                for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
                        mkdir -p $sys
                        if ! mountpoint -q $sys; then
                                if ! mount -n -t cgroup -o $sys cgroup $sys; then
                                        rmdir $sys || true
end script

        # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker)
        DOCKER_OPTS='-H tcp:// -H unix:///var/run/docker.sock'
        if [ -f /etc/default/$UPSTART_JOB ]; then
                . /etc/default/$UPSTART_JOB
        exec "$DOCKER" daemon $DOCKER_OPTS
end script

# Don't emit "started" event until docker.sock is ready.
# See https://github.com/docker/docker/issues/6647
post-start script
        DOCKER_OPTS='-H tcp:// -H unix:///var/run/docker.sock'
        if [ -f /etc/default/$UPSTART_JOB ]; then
                . /etc/default/$UPSTART_JOB
        if ! printf "%s" "$DOCKER_OPTS" | grep -qE -e '-H|--host'; then
                while ! [ -e /var/run/docker.sock ]; do
                        initctl status $UPSTART_JOB | grep -qE "(stop|respawn)/" && exit 1
                        echo "Waiting for /var/run/docker.sock"
                        sleep 0.1
                echo "/var/run/docker.sock is up"
end script

So the only thing that needs to be done now is to just add -H tcp:// -H unix:///var/run/docker.sock to DOCKER_OPTS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.