shou2017.com
JP

Installing Docker on Mac

Sun Nov 19, 2017
Sat Aug 10, 2024

I tried installing Docker on Mac, but I ran into a few issues, so here’s a memo.

Installing Docker for Mac

First, download and install Docker for Mac from the official website.

Install Docker for Mac

There are two versions available: the Stable channel (stable version) and the Edge channel (latest version). For now, install the stable version.

Follow the official documentation for the rest.

Check if the installation was successful:

$ docker --version
Docker version 17.03.0-ce, build 60ccb22

$ docker-compose --version
docker-compose version 1.11.2, build dfed245

$ docker-machine --version
docker-machine version 0.10.0, build 76ed2a6

Starting nginx

Run the following command to start nginx on port 80:

$ docker run -d -p 80:80 --name webserver nginx

Since it’s running on port 80, access it at http://localhost/:80. Be careful here.

Installing Docker on Mac

That’s it, you’re good to go.

Checking Docker Processes

Use the following command to check Docker processes:

$ docker container ls

Stopping and Starting Docker Containers

To stop a container:

$ docker container stop webserver
# docker container stop {container_name}

To start a container:

$ docker container start webserver
# docker container start {container_name}

To display containers that are not running:

$ docker container ls -a

Removing nginx

Removing a Container

$ docker container rm webserver
# docker container rm {container_name}

Removing an Image

$ docker image rm nginx
# docker image rm {ID or image_name}