martinrusev
11/27/2013 - 9:45 AM

Docker examples

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