As a note to myself this is how I start up my containerised Nginx Docker instances.
docker run --name blog_nginx -v /Users/$USERNAME/blog/public:/usr/share/nginx/html:ro -v /var/nginx/conf:/etc/nginx:ro -p 32768:80 -p 32767:443 -d nginx
docker run is the command to start the container.
--name blog_nginx gives the container a name.
-v /Users/$USERNAME/blog/public:/usr/share/nginx/html:ro links the
/Users/$USERNAME/blog/public directory on the host machine with the nginx root folder
/usr/share/nginx/html in the containerised Docker instance. You can also use
:ro indicates that these linked folders are read only within the container.
-p 32768:80 and
-p 32767:443 map the ports from the host to the container. You can also use
-P without specifying the ports. This assigns random port numbers to what ever is exposed in the container.
-d nginx tells docker to start all the preceding with the nginx image. The
-d flag or
--detach tells the host to run the container in the background.