Docker Run

Docker run command create container from IMAGE and run it.

Here we run nginx docker image.

-d = detach after starting container.

-p 80:80 = port 80 on host machine is mapped to port 80 inside container.

Now you will be able to access Nginx server by visiting IP of host machine.

To stop running container, run

To start

Docker Volumes

Docker volume can be specified with -v, it allow you to share a folder in host machine with docker container.

Here folder /var/www/html on host machine will be mounted as /usr/share/nginx/html in the container. This allows you to make the data persistent.

See Docker