Docker Documentation References:
The purpose of this kata is to familiarize yourself with the process of exposing a network port on a running Docker Container
In this exercise, we will run a simple NGINX image and publish its network interface.
Command
docker run --detach --publish 8080:80 nginx:stable-alpine
Here, --detach causes the container to run as a daemon and --publish maps localhost port 8080 to the containers port 80
Output
thought:DockerKata rich$ docker run --detach --publish 8080:80 nginx:stable-alpine
91b256c402a1cb4ed6745c7621be6346689236387208284cf58df430e812e248
Command (in another terminal):
open http://localhost:8080
Or click here
Command
docker stop 91b256c402a1cb4ed6745c7621be6346689236387208284cf58df430e812e248
Output
thought:DockerKata rich$ docker stop 91b256c402a1cb4ed6745c7621be6346689236387208284cf58df430e812e248
91b256c402a1cb4ed6745c7621be6346689236387208284cf58df430e812e248