Skip to content

container compose doesn't support extends #7

Description

@JesusDR01

Looks like extends is not working in container-compose but it is working using Docker desktop

 container-compose up   
Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "services", intValue: nil), 
_DictionaryCodingKey(stringValue: "mongo", intValue: nil), CodingKeys(stringValue: "image", intValue: nil)], 
debugDescription: "Service must have either \'image\' or \'build\' specified.", underlyingError: nil))
 cat docker-compose.yml 
version: '3.1'

services:
    mongo:
      extends:
         file: ./dev/docker-compose/docker-mongo-replica-set/docker-compose.yml
         service: mongo-replica

    firebase-emulator:
        extends:
          file: ./dev/docker-compose/firebase-emulator/docker-compose.yml
          service: firebase-emulator
        container_name: firebase-emulator
        ports:
            - "4000:4000" #Emulator UI
            - "9099:9099" #Firebase Auth
            - "9199:9199" #Firebase Cloud Storage
            - "9000:9000" #Firebase Realtime database
        volumes:
            - ./dev/docker-compose/firebase-emulator/data:/firebase/data:rw
            - ./firebase.json:/firebase/firebase.json:ro

    firebase-emulator-itests: #this is only used for itests, to make sure dev-data is not wiped on the normal fb-emulator. Make sure to adjust your .env.testing-file accordingly
        extends:
          file: ./dev/docker-compose/firebase-emulator/docker-compose.yml
          service: firebase-emulator
        container_name: firebase-emulator-itests
        ports: #the host-ports have a leading `1` compared to the normal ports, make sure to use that port instead of the normal one in your .env.testing-file
          - "14000:14000" #Emulator UI
          - "19099:19099" #Firebase Auth
          - "19199:19199" #Firebase Cloud Storage
          - "19000:19000" #Firebase Realtime database
        volumes:
          # Mounting a different firebase.json-config into the container to make it run on different ports
          - ${PWD}/dev/docker-compose/firebase-emulator/firebase_itest.json:/firebase/firebase.json

networks:
  ev:
      name: ev
cat ./dev/docker-compose/docker-mongo-replica-set/docker-compose.yml                  
version: '3.8'

services:
  mongo-replica:
    build: .
    container_name: mongo-replica
    ports:
      - "27017:27017"
      - "27018:27018"
      - "27019:27019"
    volumes:
      - ./data/mongo1:/data/mongo1
      - ./data/mongo2:/data/mongo2
      - ./data/mongo3:/data/mongo3
container-compose up  
Error: dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "services", intValue: nil), _DictionaryCodingKey(stringValue: "mongo", intValue: nil), CodingKeys(stringValue: "image", intValue: nil)], debugDescription: "Service must have either \'image\' or \'build\' specified.", underlyingError: nil))

Activity

  1. Mcrich23 commented on Sep 28, 2025

    @Mcrich23
    Owner

    Hey! Thanks for submitting an issue.

    I've never heard of extends before. I totally will investigate it, but I would be more than happy to merge in a pr if you made one.

  2. Mcrich23 commented on Sep 9, 2026

    @Mcrich23
    Owner

    I'm still happy to support this if you or someone else would like to work on it. We'd need to load the inherited service before checking for image or build, with tests for merging and circular references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions