A docker is an open source widely used software platform that helps you easily create, deploy, and manage containers. In docker, the containers are lightweight, standalone executable packages of software that have everything included used for running an application: code, runtime, system libraries, tools and settings.
A docker daemon is a system process that manages docker containers and allows you to create, start, stop, and delete containers as well as handles networking and storage for containers.
Read in detail from this guide to learn how to start docker daemon on a Mac system.
Why is Running Docker Daemon on MacOS Important?
Running docker daemon on macOS is important since it allows you to run docker containers, deploy applications to different environments, share docker images and more. It also adds additional benefits of running docker daemon on macOS, such as improving the performance of your applications and making the environment safe for running different applications.
How to Start Docker Daemon on MacOS
To start docker daemon on macOS, you can use:
- Terminal
- GUI
1: How to Start Docker Daemon on macOS Using Terminal?
Starting docker daemon from macOS terminal is an ideal option for the users because it is a quick and easy way to start the process. Further, it also provides you with different options to customize its behavior. In addition to it, since docker daemon is a resource constraint process, it won’t slow down your Mac.
You can start docker daemon on macOS using terminal from the two methods:
- Using open docker Command
- Using the launchctl Service
1.1: How to Start Docker Daemon Using the open docker Command?
You can use the open -a docker command in the command-line terminal to quickly launch the docker application on your system. Doing this will start the docker daemon on your Mac.
1.2: How to Start Docker Daemon Using a launchctl Service?
A launchctl service is a unit file that describes a service that can be managed by launchctl, a service management utility on macOS and other Unix-like operating systems. The launchctl services are typically used to start and stop daemons, which are long-running processes that provide services to other processes. To start the docker daemon on Mac, follow the below-given steps:
Step 1: Create a file with the name docker.plist in the /Library/LaunchDaemons directory using the following command:
Step 2: Paste the following code into the docker.plist file:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs$
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.docker.daemon</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/dockerd</string>
<string>-H</string>
<string>tcp://0.0.0.0:2375</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
Step 3: Save the docker.plist file using Ctrl+X, Y and Enter.
Step 4: Now load the docker.plist file and start the docker daemon on Mac by running the following command:
Step 5: To verify docker daemon is running on Mac, you can use the following command:
If the docker daemon is running, you will see a list of all of the docker containers that are currently running.
2: How to Start Docker Daemon on macOS Using GUI?
To start docker daemon on macOS using GUI, you can follow the below-given steps:
Step 1: Open Spotlight search on your Mac system and search docker.
Step 2: Double-click on the application to open it on your desktop. Wait for the docker to start once it is started, you will see the ENGINE RUNNING status on the left side of the docker application window.
This confirms that docker daemon is started on MacOS.
Conclusion
There are two ways to start the docker daemon on macOS: using terminal and using the GUI. The terminal option is the quickest and easiest way to start the process, and it also provides you with different options to customize its behavior. Among the terminal options, the “open -a docker” command is straightforward while the launchctl service option is the complex one, but ideally perfect to start the Docker daemon on your Mac when the system boots up. The GUI option is more user-friendly, but it doesn’t offer many customization options.