Docker Community Forums

Share and learn in the Docker community.

Docker Compose IP specify questions for clarification

(Rahlquist) #1


New to docker overall but was enthusiastically encouraged by a friend so I gave it a shot. I have taken a look into it but I have some questions about specifying IP’s.

What I would like to do is assign a container an ip that exists as a virtual IP on my host. So my physical ubuntu install has more that one IP. Like so;

So now I want to create a container for say Subsonic audio server and hang it off

And I want to create a OwnCloud container and hang it off

I do this now on a server without Docker and each service while more resource intensive, they cant each run their service off port 80 on their respective IP’s.

Is this possible with compose? Will it still wind up being a bridged situation? I seem to be finding mixed information online.

(David Maze) #2

When you run the container, in plain docker run syntax, you’d specify the specific host IP address in an docker run -p option. In the docker-compose.yml syntax it looks pretty much the same,

  image: me/subsonic
  ports: [""]

(Rahlquist) #3

Thank you, that worked perfect. I guess i was over-complicating it.