How to create and run an NGINX container with Docker?
Now run the docker image using the following command.
docker run -p 8000:80 nginx
Using the above command you are running the nginx server where -p is the flag for mapping the port 8000 (local machine) to the port 80 in the container as 80 is the port on which nginx serves by default.Verify the installation by visiting the localhost at the port 8000. We will get the default page for nginx web server as follows:
Docker – Container for NGINX
Docker is an open-source platform that enables developers to easily develop, ship, and run applications. It packages an application along with its dependencies in an isolated virtual container which usually runs on a Linux system and is quite light compared to a virtual machine. The reason is that a container shares the OS kernel with only its binaries/libraries loaded with it. To know more about docker, read Introduction to docker.