Creating your own Docker image

You can always use the standard off-the-shelf Docker container for Gallium Data, but if you're going to be deploying it a lot, it may sometimes be useful to create your own Docker container based on the Gallium Data container, and configure it just the way you want it. This can make deployment easier and less error-prone.

If you've never created a Docker container before, we recommend consulting the Docker documentation first. This is not rocket science, but it's not completely intuitive either.


There are two ways to create your own Docker image:

  • customize the standard image while it's running and commit it

  • create your own Dockerfile

Generally speaking, creating your Dockerfile is better because it's more repeatable. When the next version of the Gallium Data image is released, you'll be able to upgrade your custom image easily, whereas it may take more work with the "change-and-commit" approach.

Customizing the standard Gallium Data image

Start the Gallium Data image, typically without any command-line options, e.g.:

docker run -d \
--name gallium-data \
-p 8088:8080 \
galliumdata/gallium-data-engine:<version>

Unless this is the first time you run the Gallium Data image, this should start in a second or two. Make sure it's running:

docker ps

You should see something like:

CONTAINER ID IMAGE COMMAND CREATED STATUS etc...56dc324415bd gallium-data/gallium-data-engine "/runGalliumData.sh" 5 seconds ago Up 5 seconds etc...

If you don't see the gallium-data line, that means the container did not start correctly. Use the command docker logs gallium-data to see what the problem might be.

Once the image is up, you can log into it with docker exec -it gallium-data sh and modify whatever is required. You can, for instance, change how logging is done, or install a repository. The locations of important files in the image are:

  • /RunGalliumData.sh : this is the script that starts Gallium Data.

  • /galliumdata/jars : this directory is where all the Java libraries are kept. You can add your own here, and they will automatically be available to your JavaScript code.

  • /galliumdata/settings : contains the settings file, in particular the one for Gallium Data itself.

  • /galliumdata/repo : the default repository, you can replace it with your own repository

  • /galliumdata/crypto : the location for the keys and certificates for the web/REST service

  • /galliumdata/node_modules : the location for JavaScript libraries

Once you've made all the desired changes, you can commit your changes to your own Docker image with something like:

docker commit gallium-data jdoe/gallium-custom:1

From then on, you can run that custom image instead of the standard Gallium Data image, and it will include all your changes. However, note that when a new version of the Gallium Data image is released, you will need to go through the same process (assuming you want to upgrade).

Creating your own Dockerfile

This is conceptually similar to the previous process, except all the changes will be defined in a file, which makes this much more repeatable.

In a directory, create a file called Dockerfile that starts with:

FROM galliumdata/gallium-data-engine:<version>

Add whatever modifications you wish using Docker's Dockerfile syntax, e.g.

FROM galliumdata/gallium-data-engine:<version>

COPY mylib.jar /galliumdata/jars/

Then build your custom Docker image with:

docker build -t "gallium-custom:1" .

This will create the image and add it to your library of Docker images. You can then run your custom image instead of the standard Gallium Data image.

When Gallium Data releases a new image, you'll simply need to update your Dockerfile to use the new version, and re-run the docker build command.