Reputation: 724
I have two Docker images :
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?
Upvotes: 0
Views: 120
Reputation: 54382
In that case you can simply skip the -p
parameter like:
docker run -itd --name mysql mysql
docker run -itd -p 8080:8080 --link mysql:mysql --name tomcat tomcat
Upvotes: 1