Docker proposes to solve this problem with the help of the swarm mode. Make your main host a swarm manager:
docker swarm init --advertise-addr xxx.xxx.xxx.xxx:2377
Although if you use docker-compose, you probably already have it in swarm mode.
Run to generate a second host connection command as a working
docker swarm join-token worker
or as a backup manager
docker swarm join-token manager
Copy the resulting command and run it on the second host, connecting the second host to the swam:
docker swarm join --token <какой-то токен> xxx.xxx.xxx.xxx:2377
Deploy your services using docker-compose on one of the managers. The docker promises that all your services via load balancer will be visible on the IP of any of the hosts, as well as deploying and administering your application can be addressed to any manager, as if all services are on the same node. 