raj
raj

Reputation: 73

Docker bind to machine ip rather than 0.0.0.0

I have a docker machine and I opened a port.

However, the port is binding to 0.0.0.0 and not the ip that i assigned to the specific docker machine. This means that I wont be able to run two docker containers with services running on the same port.

What should I do? Any suggestion?

Upvotes: 5

Views: 13259

Answers (1)

gesellix
gesellix

Reputation: 3124

I assume you're trying to expose ports via docker run.

According to https://docs.docker.com/engine/userguide/networking/default_network/binding/ you can specify to which interface you want to bind to:

When you invoke docker run you can use either -p IP:host_port:container_port or -p IP::port to specify the external interface for one particular binding.

Upvotes: 5

Related Questions