Relative path of build context in docker-compose configuration is not resolved relative to the compose yml file location

I have a docker-compose project with container configurations in subdirectories like

.
├── a.yml
└── b
    └── b.yml

a.yml is

version: "2.2"

services:
  a:
    build:
      context: ./

b.yml is

version: "2.2"

services:
  b:
    build:
      context: ./

COMPOSE_FILE=a.yml:b/b.yml

docker-compose config results in

services:
  a:
    build:
      context: /Volumes/Disk/projects/docker-compose-relative-path
  b:
    build:
      context: /Volumes/Disk/projects/docker-compose-relative-path
version: '2.2'

According to https://docs.docker.com/compose/compose-file/compose-file-v2/#context the context path should be relative which it does not appear to be! For service b it should be /Volumes/Disk/projects/docker-compose-relative-path/b.
Is this considered to be a bug or just a flaw in the documentation?

1 Like

b.yml should have context ./b/. Behavior is documented here:

When you use multiple configuration files, you must make sure all paths in the files are relative to the base Compose file (the first Compose file specified with -f ). This is required because override files need not be valid Compose files.