Install Docker on Mac

From Bonus Bits
Jump to: navigation, search

Purpose

This article gives the steps to install Docker on a Mac using the Docker Toolbox package.


Docker DMG (Option 1) Recommended

This docker native version uses it's own hypervisor (Hyperkit) solution and does not require Virtualbox. It seems a little more GUI friendly. What I do like is how easy it is to add proxy information trhough the gui preferences. Of course it would be better if we never had to be behind a proxy for the rest of our life...

Gnome-sticky-notes-applet As of Test Kitchen 1.13.2 / kitchen-docker 2.6.0 you will need to add the following use_sudo: false for Kitchen to work with this style of install on macOS.

driver:
  name: docker
  use_sudo: false


Download

https://download.docker.com/mac/stable/Docker.dmg

Install

  1. Launch DMG
  2. Drag-n-Drop Docker.app to Applications folder

Setup Wizard

  1. First be sure you don't have Docker Toolbox environment variables... meaning REMOVE or comment these type of entries in your bash profile
    # export DOCKER_CERT_PATH=$HOME/.docker/machine/machines/default
    # export DOCKER_HOST=tcp://192.168.99.100:2376
    # export DOCKER_TLS_VERIFY=1
    # export DOCKER_MACHINE_NAME=default
    
  2. Then close/reopen terminal or unset etc.
  3. Browse to the Docker.app and launch for the first time in the /Applications folder.
    1. Easiest way is to open Spotlight and type Docker
  4. Go through the setup prompts

Config

  1. Open the preferences by clicking on the systray Docker icon and selecting preferences
  2. Customize CPU, Memory, Proxy, File Sharing, Registries and Privacy how you'd like.

Uninstall or Reset

You can easily uninstall or reset (factory defaults) in the preferences window.


Toolbox (Option 2)

Prerequisites


Install

  1. Download DockerToolbox
  2. Stop Virtualbox
  3. Launch DockerToolbox-1.x.x.pkg
  4. Select Continue | Customize | Install
  5. Select either Docker Quickstart Terminal or Kitematic Management Tool
  6. Optionally Login/Sign up Docker Hub account

Gnome-sticky-notes-applet You should notice that a Docker Virtualbox VM was created. This will need to be running while performing Docker tasks.


Add Env Vars (Optional)

If you want docker commands to work in your regular terminal and not just when you launch the Docker CLI; then add the following to your ~/.bash_profile

# Docker
export DOCKER_CERT_PATH=$HOME/.docker/machine/machines/default
export DOCKER_HOST=tcp://192.168.99.100:2376
export DOCKER_TLS_VERIFY=1
export DOCKER_MACHINE_NAME=default


Sources