Perform the following the steps:
- Let's launch an apache2 service inside a container using our cookbook/apache2 image and publish the service so that it runs to the external world through port 80 of the Docker host using the -p option of the docker container run command, as shown in the following code:
$ docker container run -d -p 80:80 cookbook/apache2a101ac9009f2237a2e4356e9caed6d0cf1666b5b86768f559a629d39034b4132
- Next, look at the port mapping between the container and the Docker host port using the docker container port command:
$ docker container port a101ac9009f2
80/tcp -> 0.0.0.0:80
- Evidently, port 80 of the Docker container is mapped to port 80 of the Docker host. The IP address of 0.0.0.0 implies any IP address ...