Hands-on task
Publishing ports: 127.0.0.1 vs 0.0.0.0
The server runs two containers:
admin(izzylab/minihttp:1,NAME=admin) is an internal admin panel. It must open only from the server itself:http://127.0.0.1:8080/, and not on the server's external address;site(nginx:1.27-alpine) is the public website: port 8081 on all of the server's addresses.
Right now it's the other way round: the admin panel is exposed to the outside and the site opens only locally. Fix it. You can't change the port binding of a running container — recreate both with the same names, images and NAME. The server's external address is on the eth0 interface.
The lab has its own Docker with no internet access; the images are already loaded: izzylab/minihttp:1, alpine:3.21, busybox:1.36, nginx:1.27-alpine. izzylab/minihttp is a tiny HTTP service on port 8080: GET / answers <NAME> ok, GET /call itself goes to http://<UPSTREAM>/ and answers <NAME> -> <the neighbor's reply> (or 502), GET /env shows its settings. It is configured with the environment variables NAME, PORT, BIND (the address it listens on) and UPSTREAM.
- docker run -p
- port publishing