Skip to content

Instantly share code, notes, and snippets.

@devdrops
Last active July 27, 2016 17:29
Show Gist options
  • Select an option

  • Save devdrops/e6257b71ed9665728e5e9352c647a37c to your computer and use it in GitHub Desktop.

Select an option

Save devdrops/e6257b71ed9665728e5e9352c647a37c to your computer and use it in GitHub Desktop.
Docker on Mac

Docker on Mac: Steps

Installing your first Environment

Let's assume that you're starting with a Dockerfile - and the bravery to start.

Mac/Windows requires that Docker runs from a VM (:cry:), so the best approach is using Docker Toolbox.

  1. Install Docker Toolbox (download it, then click next till the end of the world);
  2. docker-machine create --driver virtualbox AWESOME_VM to create a new environment. You can name it the way you like 😉.
  3. PROFIT!

docker-machine ls to list your VMs. You can have as many VMs as you wish and switch from one. AWESOME!

Engines On/Off

In order to start your VM, use these wise tips:

  • docker-machine stop AWESOME_VM to start;
  • docker-machine start AWESOME_VM to shut it down;
  • docker-machine rm AWESOME_VM to destroy it :goberserk:.

Enter the Matrix

  • docker-machine ssh AWESOME_VM

Build it!

  1. Navigate to /Users/path/to/your/Dockerfile;
  2. docker build -t AWESOME_IMAGE .

Make it run!

  • Once the Docker is properly builded, run docker run -i -t -p 80:80 -p 443:443 AWESOME_IMAGE /bin/bash to access the image and start the fun.

References:

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