download / install docker toolbox

OSX install process

#run ifconfig find interface name for virtual box (vboxnet0)

ifconfig | grep vboxnet

#expect ping to fail


#display route table before adding route

netstat -nr

#add route

sudo route -nv add -net 192.168.99 -interface vboxnet0

#display route table after adding route

netstat -nr

#should be able to ping now


docker-machine ls

docker-machine start default

docker-machine env default

eval "$(docker-machine env default)"

docker run hello-world

docker run -it ubuntu bash

connect to docker host

docker-machine ssh default

docker ps -a

docker rename fb3eea6a400f newname

docker start newname

docker attach newname


Disconnect without exiting

ctrl+p ctrl+q

copy file to container

docker cp ./Documents/Scripts/ newname:/tmp

Mount a volume

docker run -it -v $HOME/Documents/Scripts:/home/$USER/scripts --name testcontainer ubuntu bash

mount as read-only

docker run -it -v $HOME/Documents/Scripts:/home/$USER/scripts:ro --name testcontainer ubuntu bash

mount on a windows box

docker run -it -v //c/temp/Scripts://temp --name testcontainer ubuntu bash

Docker from shell

Save your image to a file

docker save imagename -o filepath

Creating an image

mkdir -p docker/tinkerbox

cd docker/tinkerbox/

vi Dockerfile

# This is a comment

FROM ubuntu:14.04

MAINTAINER Kevin Curran <>

RUN apt-get update && apt-get install -y python python-requests

docker build -t kevin/tinkerbox:v1 .

docker images

docker run -t -i kcurran/tinkerbox:v1 /bin/bash

Run a command in a running container

docker exec -it testcontainer /bin/bash

View container details

jq to view json output

docker inspect testcontainer | jq .

get volume mapping info

docker inspect --format "{{ .Volumes }}" testcontainer

docker inspect -f "{{ .HostConfig.Links }}" testcontainer


Allows you to run the container as an executable.

override entrypoint with 

docker run -it --entrypoint bash _____

Connect to the "hidden" docker VM on OS-X

screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty

^A k to exit

/ # cat /etc/motd

Welcome to Moby, based on Alpine Linux.

/ # ps axuwwf | grep dockerd

 1698 root       0:00 /usr/bin/dockerd --pidfile=/run/ -H unix:///var/run/docker.sock --swarm-default-advertise-addr=eth0 --debug --storage-driver aufs