3 ms·
I often use a socat docker container to proxy network traffic to docker containers. It effectively allows creating dynamic docker port mappings. For example, I
by justin_oaks 6y ago
I often use a socat docker container to proxy network traffic to docker containers. It effectively allows creating dynamic docker port mappings.
For example, I have a database with no docker port mappings (only a web application container in the same docker network accesses it directly). I can use a socat container with port mappings to proxy network traffic to the database.
- barbazoo 6y agoInteresting, what's the benefit over exposing the port through Docker?
- throwaway888abc 6y agoSecurity https://en.wikipedia.org/wiki/DMZ_(computing) https://en.wikipedia.org/wiki/DMZ_(computing)
- justin_oaks 6y agoIt is exposed through docker, just via a separate container. The reason for doing so is that a container can't have new port mappings added after it is created. Using the socat container allows me to access a port on my original container that I wouldn't be able to access unless I recreated that container. As for why the database didn't have port mappings originally, it is best not to allow network access to things unless it's necessary. It's the principle of least privilege.