How to EXPOSE Port on running container

You cannot with pure Docker, but you could run a TCP proxy:

docker run -ti --rm --net host bobrik/socat TCP4-LISTEN:9300 TCP4:172.17.0.3:9300

Will “open” port 9300 of container 172.17.0.3.

4 Likes