Getting started with Docker and Bamboo - Problem

Hi,

I read this guide:

https://confluence.atlassian.com/bamboo/getting-started-with-docker-and-bamboo-687213473.html

 

I installed Bamboo server with success at this url:

http://localhost:8085

 

I pull the remot image on Docker Hub:

sudo docker pull atlassian/bamboo-base-agent

 

When I run the agent:

sudo docker run -e HOME=/root/ -e BAMBOO_SERVER=http://localhost:8085/bamboo -i -t atlassian/bamboo-java-agent:latest

 

I get this error:

------------------------------------------

BAMBOO_AGENT_HOME: /root/bamboo-agent-home
HOSTNAME: 9a214dd8eea3
TERM: xterm
PWD: /
HOME: /root/
IGNORE_SERVER_CERT_NAME: false
BAMBOO_SERVER: http://localhost:8580/bamboo/agentServer/
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Running [/root/bamboo-agent-home/bin/bamboo-agent.sh, console]
Agent process started, shutdown hook registered, proceeding with log pump...
Running Bamboo Agent...
INFO | jvm 1 | 2017/07/12 10:01:03 | Exiting due to fatal exception.
INFO | jvm 1 | 2017/07/12 10:01:03 | org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:8580 refused
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
INFO | jvm 1 | 2017/07/12 10:01:03 | at com.atlassian.bamboo.agent.bootstrap.AgentContext.initFingerprint(AgentContext.java:115)
INFO | jvm 1 | 2017/07/12 10:01:03 | at com.atlassian.bamboo.agent.bootstrap.AgentContext.initServerSession(AgentContext.java:100)
INFO | jvm 1 | 2017/07/12 10:01:03 | at com.atlassian.bamboo.agent.bootstrap.AgentContext.run(AgentContext.java:91)
INFO | jvm 1 | 2017/07/12 10:01:03 | at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.run(AgentBootstrap.java:94)
INFO | jvm 1 | 2017/07/12 10:01:03 | at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.main(AgentBootstrap.java:41)
INFO | jvm 1 | 2017/07/12 10:01:03 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2017/07/12 10:01:03 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
INFO | jvm 1 | 2017/07/12 10:01:03 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2017/07/12 10:01:03 | at java.lang.reflect.Method.invoke(Method.java:606)
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO | jvm 1 | 2017/07/12 10:01:03 | at java.lang.Thread.run(Thread.java:745)
INFO | jvm 1 | 2017/07/12 10:01:03 | Caused by: java.net.ConnectException: Connection refused
INFO | jvm 1 | 2017/07/12 10:01:03 | at java.net.PlainSocketImpl.socketConnect(Native Method)
INFO | jvm 1 | 2017/07/12 10:01:03 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
INFO | jvm 1 | 2017/07/12 10:01:03 | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
INFO | jvm 1 | 2017/07/12 10:01:03 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
INFO | jvm 1 | 2017/07/12 10:01:03 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
INFO | jvm 1 | 2017/07/12 10:01:03 | at java.net.Socket.connect(Socket.java:579)
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:127)
INFO | jvm 1 | 2017/07/12 10:01:03 | at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
INFO | jvm 1 | 2017/07/12 10:01:03 | ... 17 more
Waiting for the agent process to finish...
Underlying agent process has terminated cleanly,
Bamboo Agent Installer is shutting down, the underlying agent process has already been shut down.

----------------------------------------

 

 

Any suggestions?

 

Thanks

FC

 

2 answers

1 votes

You can't use **localhost** as a Bamboo Server URL. Agent runs in a Docker container thus is means it tries to find Bamboo server in the same container (since it looks it under **localhost**). Bamboo runs outside this container thus it can't connect to it. 

 

You should use publicly accessible IP as a BAMBOO_SERVER variable 

My IP address is: 172.20.0.1

Then when I run this command:

docker run -e HOME=/root/ -e BAMBOO_SERVER=http://http://172.20.0.1:8580/bamboo -i -t atlassian/bamboo-java-agent

I get another exception:

 

BAMBOO_AGENT_HOME: /root/bamboo-agent-home
HOSTNAME: be9899b5ad1f
TERM: xterm
PWD: /
HOME: /root/
IGNORE_SERVER_CERT_NAME: false
BAMBOO_SERVER: http://http://172.20.0.1:8580/bamboo/agentServer/
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Running [/root/bamboo-agent-home/bin/bamboo-agent.sh, console]
Agent process started, shutdown hook registered, proceeding with log pump...
Running Bamboo Agent...
STATUS | wrapper  | 2017/07/12 10:32:57 | --> Wrapper Started as Console
STATUS | wrapper  | 2017/07/12 10:32:57 | Launching a JVM...
INFO   | jvm 1    | 2017/07/12 10:32:57 | Wrapper (Version 3.2.3-atlassian-1) http://wrapper.tanukisoftware.org
INFO   | jvm 1    | 2017/07/12 10:32:57 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
INFO   | jvm 1    | 2017/07/12 10:32:57 | 
INFO   | jvm 1    | 2017/07/12 10:32:57 | 2017-07-12 10:32:57,708 INFO [WrapperSimpleAppMain] [AgentBootstrap] Starting Agent Bootstrap using Java 1.7.0_65 from Oracle Corporation Default charset: US-ASCII
INFO   | jvm 1    | 2017/07/12 10:32:57 | 2017-07-12 10:32:57,709 INFO [WrapperSimpleAppMain] [AgentBootstrap] Agent bootstrap using baseUrl: http://http://172.20.0.1:8580/bamboo/agentServer/
INFO   | jvm 1    | 2017/07/12 10:32:57 | 2017-07-12 10:32:57,904 INFO [WrapperSimpleAppMain] [RemoteAgentHomeLocatorForBootstrap] Using agent home located at [/root/bamboo-agent-home]
INFO   | jvm 1    | 2017/07/12 10:32:57 | 2017-07-12 10:32:57,904 INFO [WrapperSimpleAppMain] [RemoteAgentHomeLocatorForBootstrap] Using agent home located at [/root/bamboo-agent-home]
INFO   | jvm 1    | 2017/07/12 10:32:57 | 2017-07-12 10:32:57,905 INFO [WrapperSimpleAppMain] [AgentUuidInitializer] Generating new UUID for this agent: 5a93bb31-4c9e-4d02-8352-b4692cf4f73e
INFO   | jvm 1    | 2017/07/12 10:32:57 | 2017-07-12 10:32:57,909 INFO [WrapperSimpleAppMain] [AgentContext] Requesting fingerprint, url: http://http://172.20.0.1:8580/bamboo/agentServer/GetFingerprint.action?hostName=be9899b5ad1f&version=3&agentUuid=5a93bb31-4c9e-4d02-8352-b4692cf4f73e
ERROR  | wrapper  | 2017/07/12 10:32:58 | JVM exited while starting the application.
INFO   | jvm 1    | 2017/07/12 10:32:58 | Exiting due to fatal exception.
INFO   | jvm 1    | 2017/07/12 10:32:58 | java.net.UnknownHostException: http
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at java.net.InetAddress.getAllByName(InetAddress.java:1162)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at java.net.InetAddress.getAllByName(InetAddress.java:1098)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at com.atlassian.bamboo.agent.bootstrap.AgentContext.initFingerprint(AgentContext.java:115)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at com.atlassian.bamboo.agent.bootstrap.AgentContext.initServerSession(AgentContext.java:100)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at com.atlassian.bamboo.agent.bootstrap.AgentContext.run(AgentContext.java:91)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.run(AgentBootstrap.java:94)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.main(AgentBootstrap.java:41)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at java.lang.reflect.Method.invoke(Method.java:606)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO   | jvm 1    | 2017/07/12 10:32:58 |  at java.lang.Thread.run(Thread.java:745)

Maybe I set in wrong mode: 

BAMBOO_SERVER=http://http://172.20.0.1:8580/bamboo

 

Thank you

FC 

You have duplicated **http** in the URL 

 

Most probably the valid one will be:

http://172.20.0.1:8580/bamboo

Yes,

 

I made a mistake!!

 

Then with this command:

 

docker run -e HOME=/root/ -e BAMBOO_SERVER=http://172.20.0.1:8580/bamboo -i -t atlassian/bamboo-base-agent

I obtain always the first exception of  **localhost**:

 

INFO | jvm 1 | 2017/07/12 11:15:38 | Exiting due to fatal exception.
INFO | jvm 1 | 2017/07/12 11:15:38 | org.apache.http.conn.HttpHostConnectException: Connection to http://172.20.0.1:8580 refused
INFO | jvm 1 | 2017/07/12 11:15:38 | at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)

 

 

Have you tried setting up a network in docker.

docker network create [OPTIONS] NETWORK

https://docs.docker.com/engine/reference/commandline/network_create/

----- then when running connect to the network -----

Connect a container to a network when it starts

You can also use the docker run --network=<network-name> option to start a container and immediately connect it to a network.

$ docker run -itd --network=multi-host-network busybox

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,064 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot