Troubleshoot basic Docker network connectivity
Lab prerequisites
Use an approved, disposable Linux Docker Engine VM with no external network access, ordinary bridge/NAT settings, and Engine 28.0.0 or later for publication labs. Verify the local context, server version, and that all bm-v05 names used in this example are unused. Use a reviewed, preloaded busybox:1.37 image; record its digest and check that httpd, wget and nslookup are present where used. The tag is not immutable. Run commands individually, stop on unexpected failure, and clean up only resources you created. Results below are expected, not observed. Before contacting the Engine, verify the effective local endpoint including DOCKER_HOST, DOCKER_CONTEXT and CLI overrides. Recheck the approved local image ID and native platform; if the recorded digest is unavailable, report it as unknown rather than inventing one. Use owner-set resource and time limits. If prerequisites cannot be confirmed, do the paper exercise instead. The VM must have no other untrusted workloads, no external routes and no direct-routing exceptions. A loopback mapping or internal bridge alone does not provide these guarantees. Use only a patched, supported Engine release meeting the stated minimum.
Work from evidence
First check whether the server container is running. Then confirm both endpoints use the intended network. Check name resolution and the actual service port. Finally inspect the HTTP response. A refused connection may mean no listener or an active rejection; a timeout may reflect filtering or a slow service. Neither message proves the cause alone. Do not disable firewalls or publish extra ports just to fix a peer connection.
Establish a working baseline
Set up a server on a fresh internal network. Inspect state and the single expected network before testing the HTTP path. The client has a bounded socket timeout and is removed after execution. If the baseline fails, stop the experiment and diagnose readiness or missing applets first.
docker network create --driver bridge --internal bm-v05-diag-netdocker run -d --pull=never --name bm-v05-diag --network bm-v05-diag-net busybox:1.37 sh -c 'mkdir -p /tmp/www && printf "ByteMind network lab\n" > /tmp/www/index.html && exec httpd -f -p 8080 -h /tmp/www'docker inspect --format '{{.State.Status}}' bm-v05-diagdocker network inspect --format '{{range .Containers}}{{.Name}}{{end}}' bm-v05-diag-netdocker run --rm --pull=never --network bm-v05-diag-net busybox:1.37 wget -T 3 -qO- http://bm-v05-diag:8080/Expected: running server, correct network member, and the static response ByteMind network lab.
Compare a wrong port with the right port
This next request deliberately uses an unused port on your own lab server. A nonzero status is expected for this one command, not a reason to change security settings. Record the actual status immediately. Then use the correct port again and clean up. Do not probe any other ports or targets. Before proceeding after the negative test, verify that the client actually ran and that the failure came from the requested service path, not an image or daemon error. The socket timeout is not a guaranteed wall-clock deadline; the owner must bound total run time separately.
docker run --rm --pull=never --network bm-v05-diag-net busybox:1.37 wget -T 3 -qO- http://bm-v05-diag:8081/printf 'client status: %s\n' "$?"docker run --rm --pull=never --network bm-v05-diag-net busybox:1.37 wget -T 3 -qO- http://bm-v05-diag:8080/docker stop bm-v05-diagdocker rm bm-v05-diagdocker network rm bm-v05-diag-netExpected: the first request fails, the second returns the known response. Exact stderr and exit status number depend on the fixture. If the wrong-port request succeeds, the fixture differs from the assumed setup; stop and investigate.
Manual practice
A peer resolves the server name but cannot obtain an HTTP response. List three distinct checks in order, then explain why publishing a new host port is not the first fix.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Troubleshoot basic Docker network connectivity — Knowledge check
Apply the concepts from this lesson.
The name resolves, but the HTTP request fails. What should you check next?
A timeout occurs. What does this prove?
Which correction preserves the intended private network?