Build the future of communications.
Start building for free

Docker Workflow on OSX in 60 Seconds


Getting started with Docker feels more like a game of Simon than it does learning a new tool. Using Docker on OSX requires, at a minimum, boot2docker and docker. Multi-container applications require docker-compose, as well. It’s extremely easy to confuse the interfaces for each of these applications. For example, build, up, start, stop, ps, and save are commands shared across two, if not all three of the applications. The cheat sheet below covers the most basic workflow necessary to work with docker.

Setting Up:

Download and install the latest release package ( Boot2Docker-x.x.x.pkg) from here. Then run the following:

$ pip install -U docker-compose
$ boot2docker init

Running Applications:

$ boot2docker up
$ eval "$(boot2docker shellinit)"

For a single container:

$ docker build -t yourapp_image .
$ docker run --name yourapp_container yourapp_image

Or for multiple containers:

$ docker-compose up

Breaking Down:


For a single container:

$ docker stop yourapp_container

Or for multiple containers:

$ docker-compose stop

Cleaning Up (Optional):

## Remove all images and containers (useful for out of disk space errors)
$ docker rmi $(docker images -q)
$ docker rm -f $(docker ps -aq)
## Gracefully shutdown your VM
$ boot2docker stop
## Remove VM and its disk image
$ boot2docker delete

If you have any questions or feedback, please don’t hesitate to leave a comment below or reach out to me via Twitter @brodan_.


Sign up and start building
Not ready yet? Talk to an expert.