JIYIK CN >

Current Location:Home > Learning > OPERATING SYSTEM > Docker >

Install Docker using Homebrew

Author:JIYIK Last Updated:2025/03/26 Views:

There is no doubt that Docker containers have revolutionized the way we develop and deploy applications. They provide developers with the ability to package applications and dependencies in an isolated environment.

Recently, we've seen widespread adoption of Docker as the ultimate containerization platform. Because of this, setting up Docker on all platforms has been greatly simplified, including macOS and Windows.

Install Docker on macOS using Homebrew

Docker supports the latest versions of macOS, including macOS Big Sur, macOS Monterey, and macOS Catalina. Docker provides a local application that we can install in Applicationsthe directory and /usr/local/bincreate a symbolic link in .

Install Docker using Homebrew. It is an open source package management system that we can use to install applications on macOS.

Homebrew installs packages to their directories and then symlinks their files to /usr/local. Homebrew can be installed by running the following command in a terminal.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Now that Homebrew is installed, to install Docker, execute the following command.

brew cask install docker

This command downloads dockerthe package, runs the Docker installer, and opens the GUI to set up the configuration. Use the following command to verify that the installation was successful.

docker --version

As mentioned earlier, Homebrew installs packages to their directories and then symlinks their files to /usr/local(on macOS Intel). However, after Brew installs Docker, /usr/local/binyou may not be able to use the docker command (symlink) in .

To resolve this issue, follow the steps below.

  • Press + Spaceto open Spotlight Searchand enter Dockerto start Docker.
  • In Docker 需要特权访问the dialog box, click 确定.
  • Enter your password and click OK.
  • Once we have started Docker, a whale-like icon should now be visible in the status menu. This means that all the symbol files pointing to the location of Docker have been /usr/local/bincorrectly set up in .
  • You can confirm this by executing the following command in your terminal.

Code:

$ ls -l /usr/local/bin/docker*

Now click on the Docker icon and wait for Docker to start.

Docker Icon

Finally, we will run the following command to test if your Docker installation is set up correctly.

$ docker run hello-world

Output:

Docker hello world

We have pulled the image from the Docker registry hello-worldand successfully created a Docker container using this command. This means that Docker is now properly set up in your system.

For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.

Article URL:

Related Articles

Docker deploys nginx php application

Publish Date:2025/03/26 Views:129 Category:Docker

I'm learning docker recently. I'm learning by building an nginx+php development environment example. Here I record the build process. First, give a docker-compose.yml deployment configuration file version: '3' services: nginx: container_nam

How to use Docker to image a Node.js web application

Publish Date:2025/03/26 Views:107 Category:Docker

Docker is a containerization platform that simplifies the packaging and execution of applications. Containers run as independent processes with their own file systems, but share the kernel of their host machine. Docker has attracted much at

Start a Bash terminal in a new Docker container

Publish Date:2025/03/26 Views:94 Category:Docker

Docker containers are a standard unit for packaging all the dependencies of an application, allowing us to easily run them in any environment. Containers have become very popular recently, and most developers now rely heavily on containers

Passing environment variables to containers in Docker

Publish Date:2025/03/26 Views:123 Category:Docker

This article will introduce how to pass environment variables to containers in Docker. Passing environment variables to containers in Docker using the -e and tags -env We will first see how to create environment variables and pass them to t

Running a Docker instance from a Dockerfile

Publish Date:2025/03/26 Views:139 Category:Docker

Docker containers have undoubtedly become the standard unit for managing software and dependencies in different environments. When using real applications, you must create a docker file before building the container image of the application

Copy files from host to Docker container

Publish Date:2025/03/25 Views:127 Category:Docker

This article will discuss and demonstrate methods we can use to transfer files from the host to a running container in Docker. docker cp Copy the file from the host to the Docker container using docker cp The command is one of the simplest

Get the IP address of the Docker container

Publish Date:2025/03/25 Views:102 Category:Docker

This article demonstrates how to get the IP address of a Docker container. Connect to the Bridge network and get the IP address of the Docker container One of the big reasons why docker containers are so convenient is that we can easily con

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial