Navigate to the following link to download Docker for Mac at https://docs.docker.com/docker-for-mac/install/.
To start the installation, click on the Get Docker for Mac (Edge) button and follow the instructions.
Once you have successfully installed Docker for Mac, please open a Terminal. Press command + spacebar to open Spotlight and type terminal, then hit Enter. The Apple Terminal will open as follows:

Type docker --version in the Command Prompt and hit Enter. If Docker for Mac is correctly installed, you should get an output similar to the following:
$ docker --version
Docker version 18.02.0-ce-rc2, build f968a2c
To see whether you can run containers, enter the following command into the Terminal and hit Enter:
$ docker run hello-world
If all goes well, your output should look something like the following:

Congratulations, you are now ready to work with Docker containers.