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

  • Extend docker devicemapper loop-lvm sparse file
  • Docker unable to start an interactive shell if the image has an entry script
  • Nesting variables in Apache config
  • Docker compose - access data from container A in container B
  • Having problems deploying an go app to docker
  • systemd and systemctl within Ubuntu Docker images [closed]
    • 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.

  • How can I use a variable inside a Dockerfile CMD?
  • Do Docker containers share a single Python GIL?
  • Alternative to supervisord for docker
  • Docker swarm with Glassfish image fails to start nodes
  • Docker: Error checking TLS connection: Error checking and/or regenerating the certs: There was an error validating certificates
  • docker for windows mount a folder but can't open it after several hours
  • 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.