Skip to content

wtsi-hgi/docker-baton

Repository files navigation

Build Status

baton in Docker

baton in a Docker container.

Variants

Docker Hub hosted versions of some of these Docker images are available at: https://hub.docker.com/r/mercury/baton/. The custom version builds are not on Dockerhub as it does not support the use of build arguments. The versions that are not tied to a specific commit (e.g. ones linked to a branch) are not hosted on Dockerhub as the commit used is determined at build time.

Hard-coded

Custom

To build a custom version of baton, BRANCH (either tag or branch name) and REPOSITORY must be given as build arguments.

Building the container

(You will only need to explicitly build the container if you are not using images from the Docker Hub repository.)

Before building a specific baton image, you must first build the corresponding base image:

  • For baton using iRODS 3.3.1:
docker build -t mercury/baton:base-for-baton-with-irods-3.3.1 base/irods-3/3.3.1
  • For baton using iRODS 4.x.x:
docker build -t mercury/baton:4-base base/irods-4/4.1.8
  • For baton using iRODS 4.1.8:
docker build -t mercury/baton:base-for-baton-with-irods-4.1.8 base/irods-4/4.1.8

Then, to build the baton image:

docker build -t mercury/baton:x.xx.x-with-irods-x.x.x x.xx.x/irods-x.x.x

# e.g.
docker build -t mercury/baton:0.16.2-with-irods-4.1.8 0.16.2/irods-4.1.8
docker build --build-arg BRANCH=0.16.1 --build-arg REPOSITORY=https://github.com/wtsi-npg/baton.git -t mercury/baton:custom-0.16.1-with-irods-3.3.1 custom/irods-3.3.1

Using the container

Running

Supplying configuration through environmental variables

docker run -it -e IRODS_USERNAME=${username} -e IRODS_HOST=${host} -e IRODS_PORT=${port} -e IRODS_ZONE=${zone} -e IRODS_PASSWORD=${password} mercury/baton:${tag} ${baton_command}

# e.g.
docker run -it -e IRODS_HOST="192.168.99.100" -e IRODS_PORT=1247 -e IRODS_USERNAME="rods" -e IRODS_ZONE="iplant" -e IRODS_PASSWORD="rods" mercury/baton:0.16.1-with-irods-3.3.1 baton
docker run -it --link icat:icat -e IRODS_HOST="icat" -e IRODS_PORT=1247 -e IRODS_USERNAME="rods" -e IRODS_ZONE="testZone" -e IRODS_PASSWORD="irods123" mercury/baton:0.16.2-with-irods-4.1.8 baton

Suppling configuration by mounting them

docker run -it -v ${local_directory}:/root/.irods -e IRODS_PASSWORD=${password} mercury/baton:${tag} ${baton_command}

# e.g.
docker run -it -v /home/you/.irods:/root/.irods -e IRODS_PASSWORD="mypassword" mercury/baton:0.16.1-with-irods-3.3.1 baton

Notes

  • If an incorrect password is supplied with IRODS_PASSWORD, the run will terminate with a non-zero exit status (unless DEBUG is set).
  • IRODS_PASSWORD is optional; a .irodsA file may be mounted instead. If neither, the first query to the iRODS server will require authentication.
  • If the configuration is mounted, it will not be overridden with configurations supplied using environmental variables.

Testing software with a baton dependency

test-with-baton was made specifically to test software with a baton dependency. It handles all the setup of baton and iRODS, producing a set of binaries that will act in exactly the same way as if baton was installed on the test machine.

Using with a containerised instance of iRODS

If you wish to try baton with a test instance of iRODS, these iRODs server Docker images can be used.

Debugging

The best way to find out what is going on in the container is to go into a shell. To get into a shell, even if your iRODS connection setup has a problem, set DEBUG to 1:

docker run -it -e DEBUG=1 mercury/baton:${tag} bash

To bypass the setup script all together:

docker run -it --entrypoint=bash mercury/baton:${tag}

It is possible to use iRODs icommands to debug the configuration.