Difficulty: Beginner
Estimated Time: 10 minutes

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Auto Port Mapping

  • Publishing Ports
    Run Nginx and let Docker choose a high port:
    docker container run -d -p 80 --name nginx-high nginx Visit https://[[HOST_SUBDOMAIN]]-<>-[[KATACODA_HOST]].environments.katacoda.com/

  • Run Nginx and let Docker determine exposed ports and mapping: docker container run -d -P --name nginx-auto nginx Visit https://[[HOST_SUBDOMAIN]]-<>-[[KATACODA_HOST]].environments.katacoda.com/

  • Show open ports:
    docker container ls

  • For communication within the network, use the exposed port.

  • For communication external to the network, use the published port.