Extend service in docker-compose 3

This is very easy with YAML:

version: "3"

services:
  myservice: &myservice
    build:
      context: ./myservice
    command: ./something
    environment: &myservice_environment
      VAR1: "val1"
      VAR2: "val2"
      VAR3: "val3"

myotherservice:
    <<: *myservice
    environment:
      <<: *myservice_environment
      VAR1: "val1-bis"

See the doc regarding extension-fields

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)