12
CodeMonkeys Phelim Bradley

Docker

Embed Size (px)

Citation preview

CodeMonkeysPhelim Bradley

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.

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?

Docker is not a VM

Virtual Machine Docker

Example of basic commands

• Search• Pull• Run• Commit• Push• Inspect

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.

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.fastqMykrobe.predictor.tb: Cannot open file /Users/phelimb/Dropbox/Mykrobe_test_samples/tb.fastq

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

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.

Docker compose

• Docker compose allows you to create complex container configuration simply.

• Write a docker-compose.yml– Run docker-compose up– Example

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

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)