Docker EXPOSE a port only to Host

Is docker capable of exposing a port only to the host and not to the outside.

I need to put a docker running with a mongo database, and I wanted that it was only accessible from the host, but I need to link the host port 27017.

Is this possible, or do the only possible way is to change firewall definitions?


Sure, just bind it to localhost, like this:

docker run -p

Also: Your host can also talk to each container normally over its IP. Use docker inspect $ID to get a json dump (beside other stuff) containing the network IP.

Need Your Help

Difference between @interface declaration and @property declaration

objective-c iphone properties

I'm new to C, new to objective C. For an iPhone subclass, Im declaring variables I want to be visible to all methods in a class into the @interface class definition eg

What .NET collection provides the fastest search

c# .net search collections

I have 60k items that need to be checked against a 20k lookup list. Is there a collection object (like List, HashTable) that provides an exceptionly fast Contains() method? Or will I have to write ...