Courses
Docker Intermediate: Images and Compose That Survive Real Projects
Check Yourself: Networks Beyond Defaults
Five scenario questions on name lookup, localhost, aliases, published ports and EXPOSE. If you miss more than one, reread the lessons in this section.
Course content
Join this Course
Sign in to save your progress.
-
Dockerfiles That Don't Rot
-
.dockerignore and What Belongs in the Build Context
-
ENTRYPOINT, CMD and When to Override Them
-
-
-
Data That Outlives Containers
-
Bind Mounts vs Named Volumes: Which One When
-
Permissions, Ownership and Why the Container Can't Write
-
-
-
Networks Beyond Defaults
-
Bridge Networks, Aliases and DNS
-
Publish Ports Without Exposing Everything
-
-
-
Compose for Real Apps
-
Services, depends_on and Healthchecks
-
Environment Files, Secrets and What Not to Commit
-
-
-
Images Across Machines
-
Tag Images So You Can Find Them Later
-
Push and Pull From a Registry Without Surprises
-
-
- Final Check: Docker Intermediate
1.
Two containers are on the default bridge network. One asks for http://plain-web and gets bad address. What explains it?
2.
Your app container uses the address http://localhost:5432 to reach the database container and gets connection refused. The database is healthy. What is wrong?
3.
Two containers are started on one network with the same --network-alias api. A third container looks up api. What happens?
Only the container that started first answers, always.
The lookup returns the addresses of both containers, which spreads requests but does not check whether either one is healthy.
Docker refuses the second container because the alias is taken.
The lookup fails because aliases need a published port.
4.
You run docker run -p 5432:5432 for a development database with a default password. What is the problem, and what is the better command?
There is no problem, because Docker blocks outside traffic by default.
-p only works with 127.0.0.1, so your command fails.
The port number is wrong, because databases cannot use 5432 in a container.
The port is published on every network interface, so other computers on your network can reach it. Use -p 127.0.0.1:5432:5432, or publish nothing and let other containers connect by name.
5.
A Dockerfile has EXPOSE 8080. You start the container with docker run and no -p option. Can your browser reach http://localhost:8080?
About
Five scenario questions on name lookup, localhost, aliases, published ports and EXPOSE. If you miss more than one, reread the lessons in this section.
- Duration
- 5 min
- Last update
- 08/01/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.