compose
compose copied to clipboard
[BUG] docker compose config regression - traverses parent dirs before applying `.env`
Description
Since v2.24.4 (possibly before) some behaviour has changed in how docker compose resolves configuration.
It used to apply .env located in cwd, before traversing parent dirs to look for a docker-compose.yaml.
This has changed, as it will now traverse parent dirs and if it finds a docker-compose.yaml it will instead look for a .env in that directory.
Steps To Reproduce
- With files:
# ./docker-compose.yaml
services:
parent-service:
image: alpine
# ./root/subdir/docker-compose.yaml
services:
subdir-service:
image: alpine
# ./root/.env
COMPOSE_FILE=./subdir/docker-compose.yaml
- with cwd
./root, rundocker compose config- it used to be the config based on the subdir, but now it is based on the parent dir.
Compose Version
❯ docker compose version
Docker Compose version 2.24.6
❯ docker-compose version
Docker Compose version 2.24.6
Docker Environment
❯ docker info
Client:
Version: 25.0.3
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: 0.12.1
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 2.24.6
Path: /usr/lib/docker/cli-plugins/docker-compose
Server:
Containers: 1
Running: 0
Paused: 0
Stopped: 1
Images: 168
Server Version: 25.0.3
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: true
Native Overlay Diff: false
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7c3aca7a610df76212171d200ca3811ff6096eb8.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.6.20-1-lts
Operating System: EndeavourOS
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 31.13GiB
Name: me-ks-workstation
ID: LZUL:AHQY:J4CD:JHCE:7JGD:RRWI:YO7G:AHMS:LUAW:YOQ3:OQCG:HB37
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Anything else?
No response