compose-spec / compose-spec

The Compose specification

Home Page:https://compose-spec.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect compose file name for override examples

ToshY opened this issue · comments

What is the problem you're trying to solve

Migrating the docker-compose.yaml notation to compose.yaml notation, I came across an issue when renaming the docker-compose.override.yaml file.

The compose spec denotes the use of overide.compose.yaml (also misspelled overide instead of override) in https://github.com/compose-spec/compose-spec/blob/master/13-merge.md#reset-value as well as https://docs.docker.com/compose/compose-file/13-merge/#reset-value, but having such a filename in the working directory does not actually override the config anymore.

Instead, if I use compose.override.yaml the functionality works like I expected.

Reproduction

./docker-issue/compose.yaml

services:
  nginx:
    image: nginx:1.25-alpine
    environment:
      TEST: HELLO-WORLD-ONE

Not working example

./docker-issue/override.compose.yaml or ./docker-issue/overide.compose.yaml

services:
  nginx:
    image: nginx:1.25-alpine
    environment:
      TEST: HELLO-WORLD-OVERRIDE
$ docker compose up -d
[+] Running 2/2
 ✔ Network docker-issue_default    Created                                                                             0.1s
 ✔ Container docker-issue-nginx-1  Started                                                                             0.1s
$ docker compose ps
NAME                   IMAGE               COMMAND                  SERVICE   CREATED         STATUS         PORTS
docker-issue-nginx-1   nginx:1.25-alpine   "/docker-entrypoint.…"   nginx     9 seconds ago   Up 9 seconds   80/tcp
$ docker inspect docker-issue-nginx-1 | jq .[0].Config.Env
[
  "TEST=HELLO-WORLD-ONE",
  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  "NGINX_VERSION=1.25.4",
  "PKG_RELEASE=1",
  "NJS_VERSION=0.8.3"
]

Working example

./docker-issue/compose.override.yaml

services:
  nginx:
    image: nginx:1.25-alpine
    environment:
      TEST: HELLO-WORLD-OVERRIDE
$ docker compose up -d
[+] Running 2/2
 ✔ Network docker-issue_default    Created                                                                             0.1s
 ✔ Container docker-issue-nginx-1  Started                                                                             0.1s
$ docker compose ps
NAME                   IMAGE               COMMAND                  SERVICE   CREATED         STATUS         PORTS
docker-issue-nginx-1   nginx:1.25-alpine   "/docker-entrypoint.…"   nginx     7 seconds ago   Up 6 seconds   80/tcp
$ docker inspect docker-issue-nginx-1 | jq .[0].Config.Env
[
  "TEST=HELLO-WORLD-OVERRIDE",
  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  "NGINX_VERSION=1.25.4",
  "PKG_RELEASE=1",
  "NJS_VERSION=0.8.3"
]

Describe the solution you'd like

Rename occurrences of overide.compose/override.compose to compose.override.

Additional context

Related: #467
Docker Compose version: 2.26.0