I have two Docker images :
- a tomcat image, exposing the port 8080
- a mysql image, exposing the port 3306
I run two containers using these images, linking mysql with tomcat :
docker run -itd -p 3306:3306 --name mysql mysql docker run -itd -p 8080:8080 --link mysql:mysql --name tomcat tomcat When I do that, tomcat communication with mysql works fine, and my tomcat and mysql containers are available on the server host, respectively on ports 8080 and 3306.
Now I would like the port 3306 to be closed on the server host and only available for the tomcat container. How can I do that?