Environment: Mac10.11+Boot2docker
Docker is a software that relies on boot2docker to start on mac, the latest version is 1.8 .
Note: Installed by this method, the IP address of the Docker host is not 127.0.0.1, but it has its own IP, which can be seen from the boot2docker ip, as follows:
This also explains why a nginx is installed, which cannot be accessed with http://localhost:80, but can be accessed with http://192.168.59.103:80 )
After boot2docker starts, it is a linux virtual machine.
Then suppose you want to start an nginx, just enter the docker command directly:
docker run -d --name web nginx
Main reference tutorial
nginx configuration tutorial 1
nginx configuration tutorial 2
Report the following error solution:
Post http:///var/run/docker.sock/v1.20/auth: dial unix /var/run/docker.sock: no such file or directory.
This cannot be used with sudo in mac's docker, because the environment variables are different, refer to the link