I tried installing Docker on Mac, but I ran into a few issues, so here’s a memo.
First, download and install Docker for Mac from the official website.
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
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.
That’s it, you’re good to go.
Use the following command to check Docker processes:
$ docker container ls
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
$ docker container rm webserver
# docker container rm {container_name}
$ docker image rm nginx
# docker image rm {ID or image_name}