Docker for traditional web application with load balancing?

This is rather a concept question than a technical question.

My question is: if I am going to

  • How to forward hostname based request to a specific docker container
  • Docker on Ubuntu 15.10 32 bit (OS and Processor)
  • How to configure rabbitmq.config inside Docker containers?
  • Redis regular timeouts on Docker
  • Replacing a particular instance on AWS Elastic BeanStalk?
  • Docker does not run cron job files with external origin (host - windows)
    • Setup a wordpress eshop (woocommerce) , using Apache
    • using Docker,
    • with load balancing, using HAProxy
    • implement the Micro Service Architecture

    How should I implement it?

    Here is what I came up with:

    • 1 Container: Apache + PHP
    • 1 Container: MySQL

    But I don’t know how to integrate HAProxy into the architecure.

    Can anyone please give me an idea of it?

    Also how to do load-balancing if all containers are in a single machine?

    Thank you in advance for helping.

  • Including node_modules in a nodejs Docker image, faster builds
  • Ubuntu Docker image with minimal mono runtime in order to run F# app
  • Request Entity Too Large - NextCloud in Docker
  • Do I need a private docker registry?
  • Can I expose a Docker port to another Docker only (and not the host)?
  • I can't find my Docker image after building it
  • One Solution collect form web for “Docker for traditional web application with load balancing?”

    I have done a similar thing and that too over multiple machines.

    Firstly, unless you have multiple instances of Apache+PHP, haproxy doesnt come into the picture at all.

    Otherwise: An ideal setup would be:

    request from user–>haproxy–>multiple (Apache + PHP) –>MySQL.

    Here Haproxy would give you a common public IP(of the host machine) and port for your app to be accessed. Whenever anyone accesses this IP and port, request would be forwarded to one of your Apache+PHP containers. You will have to edit your haproxy.cfg file and list the IP and port of the containers.

    This link might help you:

    Please note that here Haproxy is running on your machine and not as a Docker container.

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