This page describes how to develop, build and test Ambari on Docker.
In order to build Ambari, there are a quite few steps to execute and it is a bit cumbersome. You can build an environment in Docker and are good to go!
This is NOT meant for running production level Ambari in Docker (though you can run Ambari and deploy Hadoop in a single Docker container for testing purpose)
(This is not only about Jenkins slaves but think it is your laptop)
First, we will make a Docker image that has all third party libraries Ambari requires.
Second, prepare your code on Docker host machine. It can be trunk or a branch, or your developing code or with a patch applied. Note that your code does not reside inside of Docker container, but on the Docker host and we link it by Docker volume (like mount)
And you are ready to go!
This code has been migrated to Ambari trunk.
https://github.com/apache/ambari/tree/trunk/dev-support/docker
There are a few system requirements if you want to play with this document.
First thing first, we have to build an Docker image for this solution. This will setup libraries including ones from yum and maven dependencies. In my environment (Centos 6.5 VM with 8GB and 4CPUs) takes 30mins. Good news is this is one time.
git clone https://github.com/apache/ambari.git cd ambari docker build -t ambari/build ./dev-support/docker/docker
This is going to build a image named “ambari/build” from configuration files under ./dev-support/docker/docker
For example our unit test Jenkins job on trunk runs on Docker. If you want to replicate the environment, read this section.
The basic
cd {ambari_root} docker run --privileged -h node1.mydomain.com -v $(pwd):/tmp/ambari ambari/build /tmp/ambari/dev-support/docker/docker/bin/ambaribuild.py test -b
You want to run Ambari and Hadoop to test your improvements that you have just coded on your host. Here is the way!
cd {ambari_root} docker run --privileged -t -p 80:80 -p 5005:5005 -p 8080:8080 -h node1.mydomain.com --name ambari1 -v $(pwd):/tmp/ambari ambari/build /tmp/ambari-build-docker/bin/ambaribuild.py deploy -b # once your are done docker kill ambari1 && docker rm ambari1
You can take a look at https://github.com/apache/ambari/tree/trunk/dev-support/docker/docker/blueprints to see what is actually deployed.
There are a few other parameters you can play.
cd {ambari_root} docker run --privileged -t -p 80:80 -p 5005:5005 -p 8080:8080 -h node1.mydomain.com --name ambari1 -v ${AMBARI_SRC:-$(pwd)}:/tmp/ambari ambari/build /tmp/ambari-build-docker/bin/ambaribuild.py [test|server|agent|deploy] [-b] [-s [HDP|BIGTOP|PHD]]