Installing docker-machine on Mac

Tutu Godfrey Oritseshutieyimi
3 min readMay 3, 2019

This article will highlight the steps necessary to run docker-machine on a Mac OS. Docker-machine allows you to easily launch docker host both locally and in the cloud.

First of all, verify that you have virtualbox installed on your system by running the command virtualbox in the terminal. If you don’t have virtualbox installed head to the download page https://www.virtualbox.org/wiki/Downloads and download the one specific to your OS. After downloading, go to your download page and click on the dmg package. Which should copy the virtual box to your application folder. In your application folder, you should see this picture.

Clicking on virtualbox.pkg will take through installation steps to complete the installation. After completing the installation you will see the virtualbox in your application folder like this.

After completing the installation, you will see virtualbox in your application folder as shown below.

After installing virtualbox, to run docker-machine is seamless. To create a docker-machine simply type the following command on your terminal.
`docker-machine create — driver virtualbox my-machine-name`. You will need to replay `my-machine-name` with an appropriate name you would prefer for your machine. The command below creates a local docker host called docker-local.

docker-machine create --driver virtualbox docker-local

If the command runs successfully. You can check that your docker-machine has been created by running docker-machine ls. You should see the machine listed and state should show that the machine is running. You can now use your docker-machine for creating new instances of docker host both locally and in the cloud. In a future article, I will discuss how to use docker-machine to create docker host on Digital Ocean cloud platform

Important commands

Below are important commands to keep you up and running with your docker-machine.

docker-machine env docker-local will should you how to make connections to the docker-host. The output should look something like

export DOCKER_TLS_VERIFY="1"export DOCKER_HOST="tcp://192.168.99.100:2376"export DOCKER_CERT_PATH="/Users/godfreytutu/.docker/machine/machines/docker-local"export DOCKER_MACHINE_NAME="docker-local"# Run this command to configure your shell:# eval $(docker-machine env docker-local)

docker-machine ssh docker-local connects you to docker using ssh.

docker-machine ip docker-local to see the IP of your docker host.

docker-machine stop docker-local to stop the docker host from running.

docker-machine start docker-local start the docker host.

docker-machine restart docker-local restarts the docker host.

docker-machine rm docker-local delete/remove the docker host.

docker-machine inspect docker-local to inspect the docker host.

dockder-machine config docker-local show you the configuration info of the docker host.

docker-machine status docker-local to check the status of the docker host.

docker-machine url docker-local to get the URL of the docker host.

Thanks for reading, and I hope this article is helpful to you. If you like please share and clap.

--

--

Tutu Godfrey Oritseshutieyimi

I am a Fullstack Software engineer with commitment to delivering great products. Enthusiastic about DevOps and Linux system administration