docker / docs

Source repo for Docker's Documentation
https://docs.docker.com
Apache License 2.0
4.06k stars 6.94k forks source link

Confusing information on docker compose service 'extends' property #20287

Closed IreshMM closed 1 week ago

IreshMM commented 1 week ago

Is this a docs issue?

Type of issue

Other

Description

It says

Important: When you use multiple Compose files, you must make sure all paths in the files are relative to the base Compose file (i.e. the Compose file in your main-project folder). This is required because extend files need not be valid Compose files. Extend files can contain small fragments of configuration. Tracking which fragment of a service is relative to which path is difficult and confusing, so to keep paths easier to understand, all paths must be defined relative to the base file.

Relative paths section seems to contradict that.

Location

https://docs.docker.com/compose/multiple-compose-files/extends/

Suggestion

Remove that important message or clarify the more such that they wouldn't be any contradiction.

aevesdocker commented 1 week ago

Hi @IreshMM, The two statements do not directly contradict each other but describe different aspects of handling paths in Docker Compose. The 'Relative paths' section deals with how Docker Compose internally manages relative paths when you extend services across different files. It ensures that the relative paths in the extended service remain correct in the context of the extending service. The 'important callout' provides a guideline for users to define paths relative to the main Compose file when dealing with multiple Compose files.