- Difficulty of managing dependencies
- Maximizing isolation and transparency
- Portability of computational environment
- Make extendibility and reuse easy
- Ease of use generally
docker pull <username>/<image_name>
gets an existing image from registrydocker pull ubuntu
notice there's no username here, because this is an 'official repo'docker pull
then docker run
docker run
, which will pull
, create
and run
in one stepdocker run
:Argument | Explanation |
---|---|
-i | Interactive (usually used with -t) |
-t | Give a terminal interface for a CLI |
-p | Publish Ports: -p <host port>:<container port> |
-d | Detached mode: run the container in the background (opposite of -i -t) |
-v | Mount a volume from inside your container (that has been specified with the VOLUME instruction in the Dockerfile) |
-rm=true | Remove your container from the host when it stops running (only available with -it) |
docker run
docker run -it ubuntu
docker run -dp 8787:8787 rocker/rstudio
Command | Explanation |
---|---|
docker ps |
list all the running containers on the host |
docker ps -a |
list all the containers on the host, including those that have stopped |
docker exec -it <container-id> bash |
opens bash shell for a currently running container |
docker stop <container-id> |
stop a running container |
docker kill <container-id> |
force stop a running container |
Command | Explanation |
---|---|
docker rm <container-id> |
removes (deletes) a container |
docker rmi <container-id> |
removes (deletes) an image |
docker rm -f $(docker ps -a -q) |
remove all current containers |
docker rmi -f $(docker images -q) |
remove all images, even those not in use |
docker commit <container>
to commit a container's file changes or settings into a new imageapt-get
)docker build --rm -t <username>/<image_name> <dockerfile>
docker push <username>/<image_name>
You need to be registered at the hub bfore pushing.circle.yml
file in github repo, eg. https://github.com/benmarwick/1989-excavation-report-Madjebebe/blob/master/circle.ymldocker run -dp 8787:8787 -v /c/Users/marwick/docker:/home/rstudio/ -e ROOT=TRUE rocker/hadleyverse
-dp 8787:8787
gives me a port for the web browser to access RStudio-v /c/Users/marwick/docker:/home/rstudio/
gives me read and write access both ways between Windows (C:/Users/marwick/docker) and RStudio-e ROOT=TRUE
sets an environment variable to enable root access for me so I can manage dependenciesdocker exec -it <container-id> bash
)Presentation written in R Markdown using ioslides
Compiled into HTML5 using RStudio & knitr
Source code hosting: https://github.com/benmarwick/UW-eScience-docker-for-reproducibility
ORCID: http://orcid.org/0000-0001-7879-4531
Licensing: