Build up your own Galaxy image

Build up your own Galaxy container

The Galaxy Docker container we are using only has basic tools. Performing a complicated computational analysis can involve many many tools. We can install many tools into a Galaxy instance and save the installation work into a container. Next time when we need a Galaxy instance for data analysis, we can launch one with our own Galaxy container. The container will already have the tools we install before. We don’t need to go through the whole process again.

To build such a Galaxy container, we can simply run the command:

docker commit [CONTAINER ID] [DOCKER_USERNAME]/[CONTAINER_NAME]
  • [CONTAINER ID]: the container ID, which can be found by running the command docker ps -a.
  • [DOCKER_USERNAME]: the username of your docker hub account.
  • [CONTAINER_NAME]: the container name for identifying this container.

Let’s the see an example.

Run the command below to get container ID:

docker ps -a

You should get something similar to this.

CONTAINER ID        IMAGE                           COMMAND             CREATED             STATUS              PORTS                                                                                         NAMES
fd2d0f70a407        bgruening/galaxy-stable:17.01   "/bin/bash"         13 hours ago        Up 13 hours         443/tcp, 8800/tcp, 0.0.0.0:80->80/tcp, 9002/tcp, 0.0.0.0:8021->21/tcp, 0.0.0.0:8022->22/tcp   gallant_hugle

You will get the container ID (fd2d0f70a407), which docker image (bgruening/galaxy-stable:17.01) you are using to launch your galaxy instance, and some other information.

Build your own Galaxy image

docker commit fd2d0f70a407 mingchen0919/my_own_galaxy

Here my Docker hub account username is mingchen0919, and my docker image name is my_own_galaxy.

Use your own Galaxy image

We will use the same command to launch our galaxy instance. We just need to replace the docker image bgruening/galaxy-stable:17.01 with our own image mingchen0919/my_own_galaxy.

docker run -i -t --rm \
  -p 80:80 -p 8021:21 -p 8022:22 \
  -e "ENABLE_TTS_INSTALL=True" \
  -e "GALAXY_CONFIG_ADMIN_USERS=example@gmail.com" \
  mingchen0919/my_own_galaxy /bin/bash

Iterate Galaxy image building

If you install new tools to the Galaxy instance launched from your own Galaxy image. You can run another commit to save your work to a new Galaxy image. Note if you have uploaded some datasets and done some analysis, the uploaded data and analysis will also be committed to your new image. You probably should commit your new image before running any analysis, unless you want to integrate it to your image.

Get the new container ID by running docker ps -a. You will see something similar to this.

CONTAINER ID        IMAGE                           COMMAND             CREATED             STATUS              PORTS                                                                                         NAMES
ed2dbf76a407        mingchen0919/my_own_galaxy   "/bin/bash"         1 hours ago        Up 13 hours         443/tcp, 8800/tcp, 0.0.0.0:80->80/tcp, 9002/tcp, 0.0.0.0:8021->21/tcp, 0.0.0.0:8022->22/tcp   gallant_monster

You can commit a new image from this running container with command:

docker commit ed2dbf76a407 mingchen0919/my_own_galaxy

The command above will overwrite your my_own_galaxy image with updates. If you don’t want to overwrite it, you can choose a different name.

Push your image to Docker hub

You can push your image to Docker hub repository. If you want to run a Galaxy instance on a different machine, you can simply pull the image from the Docker hub and launch a Galaxy instance.

The command to push image to Docker hub is

docker push mingchen0919/my_own_galaxy