If there is an admin port which automatically listens in the same container as the user frontend port, that is more like an application issue. At least when using containers. When you run a process without containers, you have the entire host as your “playground” and you can make the processes listen on any IP address. When you use containers you do it to isolate the app from the host. If you put two applications into one container where one is an admin frontend, the problem is not just what the proxy will see but that if anyone hacks the user frontend will immediately have access to the admin port internally. Even if your admin frontend for example checks where the request is coming from (like it could happen in a Symfony PHP framework), the request will come from localhost. You would have a similar problem if you put a database service into an app container. Some users can access the DB only from localhost making sure that only a root user can access it, but you would make it available for your application which is used by a public community.
You can have multiple apps in an image for simplicity for example, but it is better to make it optional which one you want to run. For example:
docker run -d --name admin-frontend -e FRONTEND_MODE=admin myimage
and
docker run -d --name admin-frontend -e FRONTEND_MODE=user myimage
If these containers need some data like uploaded images in a photo gallery you could use common volumes:
docker run -d --name admin-frontend -e FRONTEND_MODE=admin -v photo-gallery-data:/app/data myimage
and
docker run -d --name admin-frontend -e FRONTEND_MODE=user -v photo-gallery-data:/app/data myimage
By recommendation with an additional proxy container was for the case when you were not the developer of the app, but you still need to use it so you give access to the user frontend through the proxy while you map a loopback ip from the host to the admin frontend.
docker run -d --name admin-frontend -e FRONTEND_MODE=admin -p 127.0.0.1:8443:8443 myimage
The above command shows only the how I would map the host port to the admin frontend. That way you could access the adminf rontend through SSH tunnel, but if you have multiple host networks, you could use a LAN IP addres too.
Then a second proxy container would forward requests to the user frontend. Using nginx or even socat that I mentioned earlier https://hub.docker.com/r/alpine/socat
Only the socat proxy would be available on the proxy network for example. If you find a proxy image which is “distroless” or a single binary thn the attacker would not even have a way to execute a shell in the container. But I don’t have more time so this is what I could describe quickly for now.
UPDATE:
By the way when using Kubernetes, you normally have one network, but you can use Network Polcies which is great, but not always easy to configure. It could solve your problem, but I would not switch to Kubernetes only for what you want. If you want to use Kubrnetes anyway, then okay. But otherwise you would have bigger problems with Kubernetes if you are not familier with it.