Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Docker compose

Docker Compose is a tool for running multi-container applications. A docker-compose.yaml file is used to define how one or more containers that make up your application are configured, such as:

version: '3.4'

services:
  restsvr:
    image: imageName
    ports:
      - 443:8000      # HOST / CONTAINER
    build:
      context: .
      dockerfile: ./Dockerfile

    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "5"

At the project root, you can create and start your application with:

docker-compose up --build -d

the flag -d stands for deamon, which is good for production. While If you want to see the logs on the terminal avoid the deamonization.