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.

  • What does BandwidthIn and BandwidthOut graph represent for a service?
  • Can't make nginx and php-fpm dockers communicate
  • fatal: destination path '/home/ipy/ipynotebooks/soccer' already exists and is not an empty directory
  • How to configure docker containers so that I can access them outside the host
  • docker-compose ignoring startup order established by depends_on
  • Setting volumes in docker-compose.yml file for windows 10 home
  • 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?

  • run docker exec from swarm manager
  • Docker REST API is not binding on port for Jenkins
  • Unable to Install PHP Zip Module via Docker Build
  • How important is a small Docker image when running?
  • How to disable write barrier on docker thinpooldev?
  • Building docker image from Dockerfile: cannot start container
  • 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.