Netflix-Skunkworks / zerotodocker

Dockerfiles to be used to create Dockerhub trusted builds of NetflixOSS
Apache License 2.0
407 stars 101 forks source link

Facilitate configuration of ports for different containers #42

Closed floer32 closed 9 years ago

floer32 commented 9 years ago

It seems to me that you can't do a good run of this using boot2docker, not without digging for Tomcat configuration files. The containers run on different internal IPs, and several things use port 8080. So, you can't expose all these services to the host machine (the machine hosting the boot2docker VM). Am I missing something?

floer32 commented 9 years ago

The end goal for me: use boot2docker with --net=host so that all containers are accessible at $( boot2docker ip ):<container_specific_port>. It's not that I'm hell-bent on running it this way, I just can't see another way to run all containers and access each container from outside of the Docker host VM ... so far I can only see SSHing into the boot2docker VM to access the various internal IPs.

cgswong commented 9 years ago

@hangtwenty You access the ports exposed from the containers via the Docker host. You can either let Docker map a port dynamically (docker run -P ....) or you manually specify the ports (docker run -p [host_port]:[docker_exposed_port] ...).

floer32 commented 9 years ago

Ah thank you for answering @cgswong, you are right! It seems this is the way ...

https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md#port-forwarding

Thanks for taking the time to address my issue.