Skip to content

Instantly share code, notes, and snippets.

@martinrusev
Last active December 29, 2015 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinrusev/7673143 to your computer and use it in GitHub Desktop.
Save martinrusev/7673143 to your computer and use it in GitHub Desktop.
Docker examples
# List all images
docker images
docker run -i -t <image:tag> <command>
# Lists all changes
docker ps -l
# Commits the last change
docker commit <image_id> <image:tag>
# Mounts a directory from the host and runs a command
docker run -v /home/martin/Dropbox/:/var/scripts -i -t base:latest python /var/scripts/osdetector.py
# Run a python file on multiple distros
#!/bin/bash
declare -a arr=(tianon/debian:7.2 tianon/debian:6.0.8 base:latest centos:latest mattdm/fedora:latest)
for i in ${arr[@]}
do
docker run -v /home/martin/Dropbox/:/var/scripts -i -t $i python /var/scripts/osdetector.py
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment