stack@docker-lab:~/docker-compose-load-balance$ cat docker-compose.yml
myapp:
image: cuentarescate1/containerip
haproxy:
image: dockercloud/haproxy
container_name: haproxy
links:
- myapp
ports:
- 80:80
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
569ce2bf3c72 dockercloud/haproxy "/sbin/tini -- docke…" 17 minutes ago Up 17 minutes 443/tcp, 0.0.0.0:80->80/tcp, 1936/tcp haproxy
0f540541e7db cuentarescate1/containerip "/bin/busybox httpd …" 17 minutes ago Up 17 minutes 8000/tcp docker-compose-load-balance_myapp_1
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$ docker-compose down
Stopping haproxy ... done
Stopping docker-compose-load-balance_myapp_1 ... done
Removing haproxy ... done
Removing docker-compose-load-balance_myapp_1 ... done
stack@docker-lab:~/docker-compose-load-balance$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$ docker-compose up --scale myapp=2 -d
Creating docker-compose-load-balance_myapp_1 ... done
Creating docker-compose-load-balance_myapp_2 ... done
Creating haproxy ... done
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$
stack@docker-lab:~/docker-compose-load-balance$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
72920f27f7fe dockercloud/haproxy "/sbin/tini -- docke…" 14 seconds ago Up 13 seconds 443/tcp, 0.0.0.0:80->80/tcp, 1936/tcp haproxy
c46891d7f376 cuentarescate1/containerip "/bin/busybox httpd …" 15 seconds ago Up 14 seconds 8000/tcp docker-compose-load-balance_myapp_1
fc83507a6ec5 cuentarescate1/containerip "/bin/busybox httpd …" 15 seconds ago Up 14 seconds 8000/tcp docker-compose-load-balance_myapp_2
stack@docker-lab:~/docker-compose-load-balance$
Comentarios
Publicar un comentario