Log In

How to Install Docker on MacOS

How to Install Docker on MacOS
20.03.2024
Reading time: 4 min
Hostman Team
Technical writer

Docker is a platform that makes it easier to create, deploy, and operate applications in containers. Containers enable developers to bundle an application's dependencies, including as libraries, frameworks, and runtime environments, and ship it as a single package. This ensures that the program runs reliably and consistently, independent of the environment in which it is deployed.

Docker allows you to automate the deployment of software inside lightweight, portable containers. These containers may operate on any system with Docker installed, making it simple to deploy apps across several settings, such as a developer's laptop, a testing server, or a production environment on the cloud. Docker also includes tools for managing and orchestrating containers at scale, making it simpler to deploy, scale, and manage complex applications in production environments.

Below are the requirements to prepare for the installation of docker on MacOS: 

  • A supported version of MacOS. Docker Desktop is compatible with the latest macOS versions. This includes the current macOS release as well as the two previous releases. As new major versions of macOS become widely available, Docker stops supporting the oldest version and instead supports the most recent version (along with the prior two).

  • RAM: minimum of 4 GB. This is to optimize Docker performance especially when operating multiple containers. 

In installing docker, you can either install it interactively or manually or via the command line interface. Here’s the guide on how to do the installation with both methods.

Manual Installation

  1. Download the installer from the official docker website using the following links:

  1. Install Docker Desktop by double-clicking the Docker.dmg

Image3

And drag and drop it to the Application folder.

Image4

By default, the Docker Desktop is installed at /Applications/Docker.

Wait for the copying to finish.

Image8

  1. Double-click the Docker from the Applications folder to proceed with the installation.

Image7

  1. Click Accept to continue in the Docker Subscription Service Agreement page.

Image1

  1. From the installation window, choose either:

    • Use recommended settings (Requires password)

    • Use advanced settings

Image6

  1. Click Finish

Image2

  1. Verify if installation is successful. A Docker icon should appear on the menu bar when the Docker Desktop is installed and running. A notification will appear stating that Docker is running.

Image5

Install using Command Line Interface

  1. Once Docker.dmg is downloaded from the official docker website, login as a super user / root in a terminal to install Docker Desktop in the Application folder. Execute the below commands respectively. 

hdiutil attach Docker.dmg
/Volumes/Docker/Docker.app/Contents/MacOS/install
hdiutil detach /Volumes/Docker

If running as a normal user, execute the command with sudo:

sudo hdiutil attach Docker.dmg
sudo /Volumes/Docker/Docker.app/Contents/MacOS/install
sudo hdiutil detach /Volumes/Docker

Image9

Installation might take some time to complete since the system may do various security checks while installing Docker on Mac.

Troubleshooting

Some of the common issues that the user might encounter during the installation of MacOS are: 

  • Users may not check the MacOs version of their machine. Take note of the system requirements when installing Docker on MacOS to avoid installation failure and unexpected behavior (like docker image becomes corrupted).

  • Errors during the installation process may occur such as failed downloads, incomplete installation, etc. Go back and check the system and hardware compatibility of the machine. 

  • Conflict with existing software. This requires troubleshooting and investigating system logs. Usually, this can be solved by removing the problematic software. 

  • Permission and security issues. When installing Docker on MacOS, ensure that the machine has all the required permission to access system resources, like directory, network, etc. 

Conclusion

To summarize, installing Docker on MacOS provides various opportunities for both developers and system administrators. Docker technology provides resources with an enhanced development workflow, an efficient procedure for delivering apps, and consistent system environments. Embrace containerization to broaden your development horizons.

Share