Docker has revolutionized the way coders work. It allows you to move code from one machine to another without having to worry about dependencies or server versions. Many operational parts of operating applications are simplified. In this article, you’ll learn how to use Homebrew to install Docker on Mac OS.
What defines Homebrew and Homebrew Cask?
Page Contents
- 1 What defines Homebrew and Homebrew Cask?
- 1.1 “Why you need Handbrew Cask to install Docker…
- 1.2 Different ways to Install Docker Desktop for Mac :
- 1.3 Installing Docker via command Line:
- 1.4 Docker engine installation for Mac Using Homebrew Package Manager:
- 1.5 Docker Desktop Installation Using Homebrew
- 1.6 Installing Docker Desktop on macOS Using a Disk Image
- 1.7 Setting up Docker on a Mac
- 1.8 File Sharing
Do you know what Homebrew is? It’s a package manager for macOS. It operates on the command line and allows you to install software for your Mac. It’s popular because it’s convenient and simple to use.
To install it is a pretty simple process, simply type
brew install[x]
and then wait a few moments However, you’ll need to use Homebrew Cask to install Docker.
“Why you need Handbrew Cask to install Docker…
If you’ve ever installed GUI software on a Mac by” the traditional method” you know that it typically requires downloading the package, opening it, and dragging and dropping it into the Application folder. By default, Homebrew can only install command-line apps.
Homebrew Cask is a Homebrew plugin that allows you to install GUI software on your Mac. This implies instead of the conventional download and drag-and-drop method, You can use this.
Also Read: 11 Must-Have Mac Utility Apps You Probably Didn’t Know About
Different ways to Install Docker Desktop for Mac :
- Open the installer by double-clicking
Docker.dmg
, then drag the Docker icon to the Applications folder.
2. To launch Docker, double-click” Docker.app” in the Applications folder. The Applications folder is shown in “grid” view mode in the example below.
3.The Docker Subscription Service Agreement window is displayed by the Docker
menu (whale menu). It includes a change to the Docker Desktop terms of service.
4. Check the box “I accept” to indicate that you agree to the updated terms, then click Accept to proceed. After you accept the terms, Docker Desktop will launch.
Note: Docker Desktop will close if you do not agree to the terms, and you will no longer be able to use it on your computer. You can accept the terms by running Docker Desktop later.
Also Read: 16 Best Apps To Customize Mac Menu Bar
Installing Docker via command Line:
To install Docker Desktop in the Applications folder, run the following commands in a terminal after downloading Docker.dmg:
$ sudo hdiutil attach Docker.dmg
$ sudo /Volumes/Docker/Docker.app/Contents/MacOS/install
$ sudo hdiutil detach /Volumes/Docker
The install
command accepts the following flags:
--accept-license
: accepts the Docker Subscription Service Agreement now, rather than requiring it to be accepted when the application is first to run--allowed-org=<org name>
: requires the user to sign in and be part of the specified Docker Hub organization when running the application.
Docker engine installation for Mac Using Homebrew Package Manager:
1. Run the following command in the macOS terminal. This command instructs Homebrew to obtain and install thedocker
. package. The most recent version will be found automatically by Homebrew.
#Install Docker Engine brew install docker
virtualbox
and docker-machine
Packages. On macOS, Docker requires both of these to function properly.
Installing VirtualBox to install Docker
Note: The –cask switch on the VirtualBox install line is worth noting. Homebrew uses the –cask option to install graphical interface programmes. The —cask switch must be provided in the command since VirtualBox is a graphical interface application.
3. After installing VirtualBox, you’ll probably get a message saying that Mac OS X has prevented the installation. Click Open Security Preferences to allow the installation.
4. Select the Details button, check the Oracle America, Inc box, and then click OK. VirtualBox is owned by Oracle.
Docker Desktop Installation Using Homebrew
Note: Do not attempt to install Docker Engine alongside Docker Desktop. As previously demonstrated, the Docker engine requires VirtualBox, which may conflict with Docker Desktop. Docker Desktop does not work with VirtualBox versions older than 4.3.30.
To install Docker Desktop, in the terminal:
- Execute the command below. It should be noted that the –cask switch is required for installing graphical interface applications with Homebrew.
2. After Homebrew has finished installing, run the following command in your terminal to launch Docker.
#Run Docker Desktop
open /Applications/Docker.app



Installing Docker Desktop on macOS Using a Disk Image
This guide is for you if you choose to install Docker on macOS using a disc image (DMG file). Depending on the type of processor you have, installing Docker via a disc image is a little different (Intel or Apple). When appropriate, the tutorial will provide a callout to distinguish itself.
Open a terminal and let’s get started installing Docker Desktop with a disc image.
- Apple Processor’s Only: Set up Rosetta. Rosetta is a programme that emulates various Intel processor behaviors, allowing applications designed for Intel processors (such as Docker) to run on Macs with Apple processors.
“The processor can be found by using the About This Mac Application”


Also Read: 6 Must Have Apps For Mac In 2022
Setting up Docker on a Mac
Now that Docker has been successfully installed on your Mac, it’s time to set up some basic Docker Desktop configurations. All Docker containers and applications running in your Docker instance are managed through the Docker Desktop Dashboard.
To access the Preferences screen, launch Docker Desktop application and click the gear icon in the top right corner of the Dashboard.
The Preferences screen contains several sections with items to customize Docker’s behavior. Following are some notable settings.
Under System Resources Consider the following:
- CPUs– The number of processors that Docker Desktop has access to. The default setting on your Mac is half of the maximum number. Raising this value improves container and application performance.
- Memory– The amount of memory that Docker Desktop has available. This value is set to 2 GB by default.
- Swap – The size of the Docker Desktop swap file. The default is 1 GB, which can be increased or decreased depending on container and application needs.
- Disk Image Size– The amount of available local disc space for Docker Desktop.
- Disk Image Location– The Docker Desktop disc image’s file system location.
File Sharing
Choose FILE SHARING from the Resources —> ADVANCED menu. The locations listed are the folders shared by your Mac’s local file system and any Docker containers and applications that are running.
To add a place, follow these steps:
- 1. On the FILE SHARING screen, click the plus button in the bottom right.
2. Select the folder you want to share with Docker Desktop and click Open.
3. Click the Apply & Restart button to apply the changes.
How to uninstall Docker Desktop
To remove Docker Desktop from your Mac, follow these steps:
Select Troubleshoot from the Docker menu, followed by Uninstall.
To confirm your choice, click Uninstall.
Also Read: 17 Best Ways To Enhance Battery In MacBook M1
Wrapping Up:
Setting up Docker on your Mac is the first step in learning about a container infrastructure model. Docker on your Mac will provide you with a location to explore and test Docker-running containers and applications.
Also Read: 15 Little-Known Mac Secrets To Transform Your MacBook