hawarden_
hawarden_

Reputation: 2170

Docker: open container port to all other containers

I'd like to know how can I open container port to all other containers?

I have three containers, and I want to open some ports to each other. I cannot use --link because it's circular link.

I have exposed ports and binded ports to host, but other containers cannot get access to it.

I cannot use docker network either because I'm using Docker 1.8 and I cannot upgrade. Thanks.

Upvotes: 0

Views: 385

Answers (1)

danday74
danday74

Reputation: 57185

to share a port to linked containers use ...

EXPOSE 8080

in your Dockerfile

WARNING the following ...

 docker run -p 8080:8080 

shares a port from host to container but NOT from container to container

insterestingly

docker run -P    (capital P)

shares all ports exposed in your Dockerfile to host (as well as other linked cotnainers)

dont forget to do your docker links

Upvotes: 1

Related Questions