learning-it by example

#311 Forward deployed engineer interviews 5.3 min

Zero Egress? Test a Docker Internal Network

A customer says no data may leave. Here is a test that shows whether a closed container can reach the internet.

1. In Docker Compose, what does setting internal to true on a network do?
2. In the zero egress test, what did the probe on the open network and the probe on the closed network print?
3. Why does the Docker zero egress test also run a probe on the open network?
4. Which of these does the video say the zero egress test does not prove?
5. What does the probe script do when it tests the public address 1.1.1.1 on port 443?

Practice only: nothing is saved and no score counts towards anything. Each answer comes with the reason.

  1. Run the egress test

    Copy the code folder first. With Docker running, in that folder run docker compose -p egress up -d peer, then docker compose -p egress run --rm -T probe_open, then docker compose -p egress run --rm -T probe_closed, then docker compose -p egress down. In the video the open probe printed internet reachable and peer name not found, and the closed probe printed internet blocked and peer reachable.

    A hint

    The control only works on a machine that has internet access.

  2. Predict a typo in the peer name

    In probe.py change PEER = ("peer", 8000) to PEER = ("peerr", 8000). Predict the peer line for the closed probe, then run the same four commands as before. This is a prediction exercise. Which of the three words reachable, name not found or blocked should it print, and why? Then change PEER back to ("peer", 8000).

    A hint

    The probe asks Docker's name lookup for the host name first.

  3. Predict what happens without internal

    In compose.yaml delete the line internal: true under closed. This is a prediction exercise. Before running anything, write down what you expect the closed probe to print for the internet and for the peer, then run the four commands and compare. What does this tell you about why the test needs a control? Then put the line internal: true back under closed, because the next exercise needs it.

    A hint

    The video says a Compose network is open to the outside by default.

  4. Predict a container on both networks

    In compose.yaml change probe_closed to networks: [closed, open]. This is a prediction exercise. Write down what you expect it to print for the internet and for the peer, then run the commands and compare. The video lists a container on both networks as a mistake. Explain in one sentence why it is one. Then change probe_closed back to networks: [closed].

    A hint

    The container is also on the open network, which is not marked internal.

These tasks are for you to try on your own machine. Nothing is checked or saved.

What this does not show

One run on one laptop with Docker 27.5.1: a container only on an internal network could not open a connection to one public address. The probe prints, it does not fail a build. A second network, host rules, a proxy, a mounted socket and name lookups were not tested. The image is not pinned by digest.

Up next in Forward deployed engineer interviews

More in Forward deployed engineer interviews

All Forward deployed engineer interviews videos

Related videos