Installing Docker on Mac

The key aspect of Docker is that it makes it easy to install and run software without worrying about dependencies.

Docker is a platform or ecosystem around creating and running containers. Within Docker’s ecosystem are various projects, tools and pieces of software that are sometimes used singularly or altogether. There are Docker Client, Docker Server, Docker Hub, Docker Machines, Docker Images and Docker Compose.

When you run a command in terminal, the Docker Client (Docker CLI) connects with the Docker Hub and downloads a Docker Image. A Docker Image is a single file containing all the dependencies and all the configuration required to run a very specific programme. A Docker Image is stored on your hard drive and you can use a Docker Image to create a Container. A Container is an instance of an image, it’s a running programme with is own isolated set of resources (memory, networking technology and hard drive space).

Within ‘Docker For Mac’ are two tools, these are Docker Client, commonly referred to as Docker CLI and Docker Server which is also known as Docker Daemon. Docker Client is a programme that accepts commands from the user and figures out how to execute them. It’s a portal that connects the user with the Docker Server which is a programme that is responsible for creating containers, maintaining containers, creating images, uploading images and pretty much every other action executable in Docker. The Docker Server runs behind the scenes and isn’t directly accessed by the user. That access is via the local machines terminal using Docker CLI.

To install Docker, first thing you’ll need to do is to sign up for a docker account at docker hub. You’ll need an account to download Docker to your local machine.

After creating a profile, navigate to, select “Get Started” (top right of the page). On the next page, under “Docker Desktop”, select “Download For Mac”

It’s a large file so will take a few seconds to download to your machine. Once done, click on it to begin installation. Again, this could take a few seconds to install.

Once that’s done, you’ll get a pop up below and you should drag and drop to your applications folder. It’s a rather large file so give it some time to copy across.

At the very top panel of your mac screen you’ll notice the docker icon. The boxes will be in constant flux, building back up, disappearing and then repeating over and over. This signifies that it’s copying across to the applications folder. Once the icon is static, with all the boxes stacked, it means that installation is complete. Click on the icon and it’ll request that you login.

After logging in, open your terminal and type in “docker version”.

If you get a result like below then your setup is complete. If you get an error message then please go to the docker website to the FAQs or restart installation.

In terminal, type in “docker run hello-world”. This starts up the Docker CLI which is in charge of taking commands from the user, takes the command typed into the CLI, contacts the Docker Server and passes through those commands. When “docker run hello-world” was typed in, we were asking the server to create a new container using the image of “hello-world”. The “hello-world” image has a programme within whose sole purpose is to print out the message below (screenshot).

Also, when that command was handed over to the Docker server, other actions occurred in the background. As we were asking the Docker Server to start a new container using the image, “hello-world”, the initial thing the server does is check to see if there’s a local copy of the “hello-world” image on the local machine by looking into the image cache. It couldn’t find “hello-world” in the image cache so it reached out to a free service called Docker Hub which is a repository of free public images. Docker server then downloads the “hello-world” image from Docker Hub and stores it in the image cache on the local machine. When “docker run hello-world” is first run, we get a message from Docker, in the terminal, stating, “Unable to find image ‘hello-world:latest’ locally”. With the image now stored in the image cache, when “docker run hello-world” is now run again, the error message won’t be displayed as the server is pulling the image from your local machine.

Junior Front-end Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store