How to hide Docker containers behind a single hostname

I’m pretty new to Docker. I started by approaching with the VM mindset, but I’m realizing that it uses a whole different paradigm from VMs, or even traditional LXC containers.

The biggest challenge has been with understanding how networking works. I’m trying to use Docker to run multiple services on a machine that require some of the same ports, to avoid port conflicts.

  • Plex using Ansible and Docker
  • Docker and symfony
  • bin mounted to alpine container fails to run with /gogs not found
  • Docker connection refused hanging Django
  • --add-host failed within play application docker container
  • docker for windows mount a folder but can't open it after several hours
  • I want to access all of them using the FQDN of the host machine, without having to worry about adding the container FQDNs to DNS. I’m forwarding the relevant container ports to unused host ports.

    The problem is that, when I try to access the services from my browser, it’s redirected to the FQDN of the container, which it can’t resolve. The result is a “Server not found” error.

    Is there a way to hide all the containers behind the host’s FQDN, without ever having to resolve the containers’ FQDNs?

  • How to set HOST_GID for Docker
  • Connection refused for Docker application on OSX
  • Docker duplicates UDP packets
  • Azure vm docker create cannot find certificate 'ca.pem'
  • How to prevent nodes from restarting in a Kubernetes Deployment
  • Bash Command Templating For Docker
  • One Solution collect form web for “How to hide Docker containers behind a single hostname”

    You can make each docker container use a different outside port and then have a server docker with something like nginx or apache that reverse proxies the requests. I had to build something like this that takes everything in at one hostname and then passes through all the traffic to the appropriate container and port.

    The difficulty is docker containers having new addresses each time they’re created. You can dynamically figure out their addresses when they start up and have the proxy container start last with those addresses. The way you can grab those addresses is with a ‘docker inspect’ and awk the data you want, or you can use one of these libraries like docker-py to grab the relevant data.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.