Using ephemeral mapping
After setting up a few container instances with specific port mappings, your team's QA member would like to know how to automatically map an ephemeral port to a container for testing. They'd like to make sure multiple container instances can be mapped without modifying the Docker command being used.
This exercise is part of the course
Intermediate Docker
Exercise instructions
- Update the Dockerfile to expose port 8000, replacing the
____
characters. - Rebuild the image with the tag named
qaserver
. - Run the proper
docker
command to automatically map the container to an ephemeral port. You may also wish to use the-d
flag to detach Docker from the terminal. - Use the
docker ps
command to check the ports being used.
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
