2. The problem: Deploying/Distributing
software is harder than it should be.
Just because your software runs on your
machine does not mean that it will run
anywhere.
Docker allows you to “containerise” your
software.
3. What is docker?
• The docker engine is a “a portable, lightweight
runtime and packaging tool”.
• Docker Hub is “a cloud service for sharing
applications and automating workflows”.
Docker + dockerhub : The git + github for
deployment?
5. Example of basic commands
• Search
• Pull
• Run
• Commit
• Push
• Inspect
6. Docker Build
• Two ways to “dockerise” containers.
– Make the container and push to dockerhub.
– Or, write a dockerfile to automate the build.
• Example – dockerizing Mykrobe predictor.
7. Working with data in docker
• Now that we’ve build our docker container for
Mykrobe we can’t run it on data on the host
system.
docker run phelimb/mykrobe ./Mykrobe.predictor.tb
--install_dir ../ --file tb.fastq
Mykrobe.predictor.tb: Cannot open file
/Users/phelimb/Dropbox/Mykrobe_test_samples/t
b.fastq
8. Working with data in docker
• We need to mount the data to the container.
docker run –v local_data/:/data/
phelimb/mykrobe ./Mykrobe.predictor.tb --
install_dir ../ --file /data/tb.fastq
9. Linking containers together
• Each docker container should run ONE
process.
• Name your containers to link them together.
• E.g.
docker run -d --name db training/postgres
docker run -ti -P --name web --link db:db
training/webapp /bin/bash
• DB ENV variables are visible in WEB.
10. Docker compose
• Docker compose allows you to create complex
container configuration simply.
• Write a docker-compose.yml
– Run docker-compose up
– Example
11. Docker makes cloud computing easier
• Docker-machine create
– Creates a docker compatible cloud instance
– Works with many cloud providors
• Docker swarm:
– Clustering for docker containers
12. Example use cases in bioinformatics
• Software comparision
– http://nucleotid.es/assemblers/
• Illumina Basespace
– Uses docker for native apps
• Docker for reproducible research:
– http://arxiv.org/abs/1410.0846
• Solves “Dependency hell”
• Analysis pipelines (nextflow.io)
## Build and Volumes
docker build .
docker run **
docker commit ** phelimb/mykrobe
docker run phelimb/mykrobe ./Mykrobe.predictor.tb --install_dir ../ --file ~/Dropbox/Mykrobe_test_samples/tb.fastq
docker run -v ~/Dropbox/Mykrobe_test_samples/:/data/ phelimb/mykrobe ./Mykrobe.predictor.tb --install_dir ../ --file /data/tb.fastq
## Linking containers
docker run -d -P --name web training/webapp python app.py
docker run -d --name db training/postgres
## Replace with linked
docker rm -f web
docker run -ti -P --name web --link db:db training/webapp /bin/bash
env | grep DB
## Compose/machine/swarm
venv/bin/docker-compose up