Docker Compose extends not overriding configuration

  docker, docker-compose

I recently updated Docker for Mac, now version 3.5.2 (66501), and since then the extends functionality in docker-compose seems to have stopped working (no idea if that’s related though).

I have one big old docker-compose.yaml file which is using extends quite a bit so I was hoping not having to change that at the moment.

To try I created this dummy docker-compose.yaml file:

version: '2.1'

services:
    base:
        image: ubuntu:18.04
        command: bash -c "echo 'i am base'"
    
    extender:
        extends:
            service: base
        hostname: extender
        command: bash -c "echo 'i am extender'"

When I do docker compose up they both echo i am base:

base_1  | i am base
extender_1  | i am base

Also if I do docker compose run extender it echos i am base.

Source: Docker Questions

LEAVE A COMMENT