Bamboo remote agent 5.13.0.1 not working inside alpine 3.4 docker container

Hi,

I try to setup a bamboo remote agent on alpine 3.4 docker container.

It is working perfectly in my centos:7 container, but i can not make it work inside my alipine container.

The master is working perfectly inside alpine container, but i have some problems with the remote agents.

Here is my error :

Running [/opt/atlassian/bamboo-agent-home/bin/bamboo-agent.sh, console]
Agent process started, shutdown hook registered, proceeding with log pump...
Running Bamboo Agent...
"/opt/atlassian/bamboo-agent-home/bin/./wrapper" "/opt/atlassian/bamboo-agent-home/bin/../conf/wrapper.conf" wrapper.syslog.ident=bamboo-agent wrapper.pidfile="/opt/atlassian/bamboo-agent-home/bin/./bamboo-agent.pid" wrapper.lockfile="/var/lock/subsys/bamboo-agent"
/opt/atlassian/bamboo-agent-home/bin/bamboo-agent.sh: eval: line 1: /opt/atlassian/bamboo-agent-home/bin/./wrapper: not found
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.

the failing command is : /opt/atlassian/bamboo-agent-home/bin/./wrapper /opt/atlassian/bamboo-agent-home/bin/../conf/wrapper.conf wrapper.syslog.ident=bamboo-agent wrapper.pidfile="/opt/atlassian/bamboo-agent-home/bin/./bamboo-agent.pid" wrapper.lockfile="/var/lock/subsys/bamboo-agent"

Here is a view of my file system :

bamboo-remote-agent-a1:/opt/atlassian/bamboo-agent-home/bin# ll /opt/atlassian/bamboo-agent-home/bin/./wrapper
-rwxr-xr-x 1 root root 117740 Sep 30 09:28 /opt/atlassian/bamboo-agent-home/bin/./wrapper

bamboo-remote-agent-a1:/opt/atlassian/bamboo-agent-home/bin# ll /opt/atlassian/bamboo-agent-home/bin/../conf/wrapper.conf
-rw-r--r-- 1 root root 2466 Sep 30 09:28 /opt/atlassian/bamboo-agent-home/bin/../conf/wrapper.conf

bamboo-remote-agent-a1:/opt/atlassian/bamboo-agent-home/bin# ll /opt/atlassian/bamboo-agent-home/bin/
total 132
-rwxr-xr-x 1 root root 15102 Sep 30 09:48 bamboo-agent.sh
-rwxr-xr-x 1 root root 117740 Sep 30 09:28 wrapper

bamboo-remote-agent-a1:/opt/atlassian/bamboo-agent-home/bin# ll /var/lock/subsys/
total 0

 

Here is the Dockerfile

# Use alpine version which is really lighter
FROM openjdk:8-alpine

ENV BAMBOO_JAR_PATH /opt/atlassian/atlassian-bamboo-agent-installer-5.13.0.1.jar

# Setup some evironnement variables
ENV container docker

# Upgrade alpine
RUN apk -U upgrade
# Add packages
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk --update add \
iputils \
bash \
vim \
curl \
wget \
make \
git \
tomcat-native \
gzip \
php5 \
php5-cli \
php5-common \
php5-fpm \
php5-gd \
php5-imap \
php5-intl \
php5-mcrypt \
php5-mysqli \
php5-opcache \
php5-pgsql \
php5-soap \
php5-xml \
&& rm -rf /var/cache/apk/*

# Install bamboo remote agent
RUN mkdir /opt && mkdir /opt/atlassian
ADD conf${BAMBOO_JAR_PATH} ${BAMBOO_JAR_PATH}

CMD java -Dbamboo.home=/opt/atlassian/bamboo-agent-home/ -jar ${BAMBOO_JAR_PATH} http://bamboo-master:8085/agentServer/

Any idea ? Is the wrapper working with Alpine ?

2 answers

1 accepted

This widget could not be displayed.

Alpine is most likely missing the dl libs required to run the wrapper. I don't think there's a workaround, you should use the agent without the wrapper.

Something like that should work:

java -classpath bamboo-agent-bootstrap.jar  com.atlassian.bamboo.agent.bootstrap.AgentBootstrap http://localhost:8085/bamboo/agentServer

 

This widget could not be displayed.

I did some research into this, and @Przemyslaw Bruski 100% right: Alpine swaps out glibc for musl libc, and the wrapper is dynamically linked against glibc libraries. You can see this in Alpine by running ldd against the wrapper:

bash-4.3# ldd bin/wrapper
/lib64/ld-linux-x86-64.so.2 (0x55e5f5866000)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55e5f5866000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x55e5f5866000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55e5f5866000)
Error relocating bin/wrapper: __fprintf_chk: symbol not found
Error relocating bin/wrapper: __printf_chk: symbol not found
Error relocating bin/wrapper: __memcpy_chk: symbol not found
Error relocating bin/wrapper: __vsnprintf_chk: symbol not found
Error relocating bin/wrapper: __read_chk: symbol not found
Error relocating bin/wrapper: __strcpy_chk: symbol not found
Error relocating bin/wrapper: __syslog_chk: symbol not found
Error relocating bin/wrapper: __sprintf_chk: symbol not found
Error relocating bin/wrapper: __realpath_chk: symbol not found

If you want to use the wrapper, the solution is to install glibc into your Alpine container. For example:

RUN apk --no-cache add ca-certificates \
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub \
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-2.25-r0.apk \
&& apk add glibc-2.25-r0.apk

(The above was found in https://github.com/sgerrand/alpine-pkg-glibc)

I maintain my own Bamboo agent Docker image: https://bitbucket.org/dchevell/docker-bamboo-base-agent/overview and I've just switched it to Alpine, and ran into the same issue. Making the above change resolved the issue and added about 10MB to the size of the image (uncompressed).

Please note: whilst I work for Atlassian support, the above is just a personal repo intended for illustration purposes and is not official or supported in any way.

 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

63 views 1 0
Join discussion

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