There are two reasons to go that way.
At first you can define a clean image for your builds. We need several components preinstalled to build some parts so we can do that once in the image and start as many qb nodes as we like with a simple "docker run" command. Also if the prerequisites change, we only need to adapt the image and are good.
Second are integration tests which start e.g. jetty, httpd, ... and the container gives a nice way to separate everything and use the hardware by running multiple integration tests in parallel.
Here a sample Dockerfile so you can test. Just place this and the buildagent.tar.gz into a directory.
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y wget
WORKDIR /opt
RUN wget -O /tmp/jdk-8u40-linux-x64.tar.gz --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u40-b26/jdk-8u40-linux-x64.tar.gz \
&& tar zxvf /tmp/jdk-8u40-linux-x64.tar.gz \
&& rm /tmp/jdk-8u40-linux-x64.tar.gz
ENV PATH /opt/jdk1.8.0_40/bin:$PATH
RUN locale-gen en_US.UTF-8
RUN echo 'LANG=en_US.UTF-8' > /etc/default/locale
COPY buildagent.tar.gz /tmp/buildagent.tar.gz
RUN tar zxvf /tmp/buildagent.tar.gz && rm /tmp/buildagent.tar.gz
WORKDIR /opt/buildagent
CMD ["./bin/agent.sh","console"]
EXPOSE 8811
Now you can build the image with
docker build -t qbagent .
And start the container using that image with
docker run -d -p 8811:8811 qbagent
To use the dynamic port mapping use
docker run -d -P qbagent
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e50c21f4c6f7 qbagent:latest "./bin/agent.sh cons 3 seconds ago Up 2 seconds 0.0.0.0:49153->8811/tcp clever_goldstine