Building Mosaic applications using Docker

Docker images provide a method to encapsulate files, configurations, and dependencies of an application in a single place. This Docker image can be shared through the cloud and can be easily pulled and run on remote workers without needing any additional setup; this method of handling applications has become increasingly popular in recent years.

It’s easy to run a Docker image as an application on Mosaic. Mosaic instances support the dx-docker functionality of the DNAnexus appkit, which allows for the pulling and running of Docker images. More information about dx-docker is available on the related DNAnexus wiki page.

In a Mosaic application, make sure that Internet Access is enabled under the VM Environment tab. A Docker image can be pulled using the following command in the app script:

dx-docker pull biocontainers/velvet
This will download the Docker image to the worker node. Once the Docker image is pulled to a worker node, it can be mounted using the following command:
dx-docker run -v /work/: biocontainers/velvet velveth $command_options

The -v /work/: flag should stay the same in all Mosaic applications; this mounts the Docker image to the home directory of the worker node. Any output created by the Docker image will be placed in the worker’s home directory if an explicit location is not otherwise specified.

For more information about creating Mosaic applications, consult the Creating apps page.