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

  • What work does the process in container “gcr.io/google_containers/pause:0.8.0” do?
  • Is it possible to run Vagrant with Docker as provider AND provisioner?
  • Install Docker on a specific volume
  • How to get exact date for docker images?
  • Script fails at build but works from Docker container
  • Docker secret not working for MYSQL_ROOT_PASSWORD_FILE
    • 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.

  • Setting up rabbitMQ on docker with python
  • How to properly start nginx in Docker
  • Is it possible to run Telegraf in Docker (and get accurate metrics)?
  • access grunt serve inside docker
  • is it advisable to have multiple applications in a single docker image
  • Cannot ping server after docker run
  • 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:
    https://serversforhackers.com/load-balancing-with-haproxy

    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.