CodeMonkeys
Phelim 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.fastq
Mykrobe.predictor.tb: Cannot open file
/Users/phelimb/Dropbox/Mykrobe_test_samples/t
b.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)

Docker

  • 1.
  • 2.
    The problem: Deploying/Distributing softwareis 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?
  • 4.
    Docker is nota VM Virtual Machine Docker
  • 5.
    Example of basiccommands • Search • Pull • Run • Commit • Push • Inspect
  • 6.
    Docker Build • Twoways 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 datain 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 datain 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 • Dockercompose allows you to create complex container configuration simply. • Write a docker-compose.yml – Run docker-compose up – Example
  • 11.
    Docker makes cloudcomputing easier • Docker-machine create – Creates a docker compatible cloud instance – Works with many cloud providors • Docker swarm: – Clustering for docker containers
  • 12.
    Example use casesin 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)

Editor's Notes

  • #2 docker docker search ubuntu docker search bwa docker search tutorial docker pull learn/tutorial docker run learn/tutorial echo "hello world" docker run learn/tutorial apt-get install -y ping docker commit xxx phelimb/ping docker inspect xx docker push phelimb/ping
  • #7  ## Build and Volumes docker build . docker run ** docker commit ** phelimb/mykrobe
  • #8  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
  • #10 ## 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
  • #11 ## Compose/machine/swarm venv/bin/docker-compose up