Use –net-alias in Docker for Easy Round Robin Load Balancing

Something I picked up on a few days ago was using Docker’s –net-alias command (or docker-compose equivalent) for cheap and easy round robin load balancing.

For example, start two elasticsearch containers with –net-alias search and from within the network, using the ‘search’ as the DNS name for connecting, you’d get 1 of the 2 servers at random.