Skip to content

Instantly share code, notes, and snippets.

@jeffdonthemic
Created August 4, 2014 15:10
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 jeffdonthemic/825238d122297c77f0ce to your computer and use it in GitHub Desktop.
Save jeffdonthemic/825238d122297c77f0ce to your computer and use it in GitHub Desktop.
Docker snippet

Great cheatsheet!! and this is a good article as well.

Start virtualbox and the vm
boot2docker start

Pull down the google go image docker pull google/golang

Find the ip attached to the container
boot2docker ip

view all running containers
docker ps

view all images
docker images

Go to the directory with the Dockerfile:
docker build -t <your-image-name> .

Start the container with a specified port to map to 8080
docker run -p 49160:8080 -d <your-image-name>

Open browser with the specified port above with the ip returned from docker2boot ip:
http://192.168.59.103:49160

View the server log output from the container
docker logs <container id>

Stop the container
docker stop <container id>

Delete the image
docker rmi <image id>

Starting the shell
docker run -t -i <your-image-name> /bin/bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment