Anonymous
×
Create a new article
Write your page title here:
We currently have 27 articles on PhenixOps. Type your article name above or click on one of the titles below and start writing!



PhenixOps
27Articles

Docker Compose: Difference between revisions

No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 14: Line 14:
       - appnet
       - appnet
   web:
   web:
  build: ../.
    image: nginx:latest
  networks:
    networks:
     - appnet
     - appnet
  ports:
    ports:
    - "3000"
    - "3000"
networks:
networks:
   appnet:
   appnet:
Line 24: Line 24:
</pre> <br>
</pre> <br>


==== Luanch Docker Compose ====
''Specifically in this example there is no port defined for the localhost in order to be able to scale the web application''<br>
 
== Docker Compose ==
 
Docker Compose groups and launches multiple containers together <br>
<code>
<code>
docker-compose -d up
docker-compose -d up

Latest revision as of 23:26, 24 April 2020

Docker Compose

Dockerfile provides a declaritive way of building images

Write a Dockerfile

version: '2'
services:
  db:
    image: mongo:latest
    container_name: db
    networks:
      - appnet
  web:
    image: nginx:latest
    networks:
     - appnet
    ports:
     - "3000"
networks:
  appnet:
     driver: bridge


Specifically in this example there is no port defined for the localhost in order to be able to scale the web application

Docker Compose

Docker Compose groups and launches multiple containers together
docker-compose -d up

Check logs

docker-logs db

docker-logs web

All
docker compose logs web