version: "2.1"
services: 
  nocodb: 
    depends_on: 
      root_db: 
        condition: service_healthy
    environment: 
      NC_DB: "mysql2://root_db:3306?u=noco&p=password&d=root_db"
    image: "nocodb/nocodb:latest"
    ports: 
      - "8080:8080"
    restart: always
    volumes: 
      - "nc_data:/usr/app/data"
  root_db: 
    environment: 
      MYSQL_DATABASE: root_db
      MYSQL_PASSWORD: password
      MYSQL_ROOT_PASSWORD: password
      MYSQL_USER: noco
    healthcheck: 
      retries: 10
      test: 
        - CMD
        - mysqladmin
        - ping
        - "-h"
        - localhost
      timeout: 20s
    image: "mysql:5.7"
    restart: always
    volumes: 
      - "db_data:/var/lib/mysql"
#    below line shows how to change charset and collation
#    uncomment it if necessary
#    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
volumes: 
  db_data: {}
  nc_data: {}