No edit summary |
|||
Line 1: | Line 1: | ||
== Docker Compose == | == Docker Compose == | ||
Docker Compose can be helpful to scale a container.<br> | |||
==== Write a Dockerfile ==== | |||
<pre> | |||
version: '2' | |||
services: | |||
db: | |||
image: mongo:latest | |||
container_name: db | |||
networks: | |||
- appnet | |||
web: | |||
build: ../. | |||
networks: | |||
- appnet | |||
ports: | |||
- "3000" | |||
networks: | |||
appnet: | |||
driver: bridge | |||
</pre> <br> | |||
==== Luanch Docker Compose ==== | |||
<code> | |||
docker-compose -d up | |||
</code> <br> | |||
==== Check logs ==== | |||
<code> | |||
docker-logs db | |||
</code> <br> | |||
<code> | |||
docker-logs web | |||
</code> <br> | |||
all | |||
<code> | |||
docker compose logs web | |||
</code> <br> | |||
[[Category:Docker]] | [[Category:Docker]] |
Revision as of 23:10, 24 April 2020
Docker Compose
Docker Compose can be helpful to scale a container.
Write a Dockerfile
version: '2' services: db: image: mongo:latest container_name: db networks: - appnet web: build: ../. networks: - appnet ports: - "3000" networks: appnet: driver: bridge
Luanch Docker Compose
docker-compose -d up
Check logs
docker-logs db
docker-logs web
all
docker compose logs web