docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
33.71k stars 5.19k forks source link

[BUG] usage of `--env-file` regressed from v2.27.0 to v2.27.1 #11906

Closed frederikhs closed 3 months ago

frederikhs commented 3 months ago

Description

Docker Compose v2.27.1 ignores the use of --env-file such as docker compose --env-file .env.prod config to override variable for the compose project.

Steps To Reproduce

I have created a repository with a github action workflow that runs the comparison test i expect is the regression: https://github.com/frederikhs/docker-compose-env-file-regression-example

Compose Version

Docker Compose version 2.27.1

Docker Environment

Client:
 Version:    26.1.4
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.15.0
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.27.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 10
 Server Version: 26.1.4
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  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: ae71819c4f5e67bb4d5ae76a6b735f29cc25774e.m
 runc version:
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.9.4-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.27GiB
 Name: rod
 ID: 5113613f-ff7b-475d-842d-d612d2132447
 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

ndeloof commented 3 months ago

Probably fixed by https://github.com/docker/compose/pull/11889 Would you have a chance to test your reproduction example with a build fro HEAD ?

frederikhs commented 3 months ago

I have added a second job testing v2.27.0 against the latest commit to the default branch (commit id 1a14fcb1e6645dd92f5a4f2da00071bd59c2e887) as of now. Seems like the issue is fixed. https://github.com/frederikhs/docker-compose-env-file-regression-example/actions/runs/9536725132/job/26283982723

What are the chances of a v2.27.2 release sometime in the near future?

AdamYogan commented 3 months ago

After upgrade, when using docker compose --env-file .env environment variable COMPOSE_PROFILES in .env stop working :-(

ndeloof commented 3 months ago

Closing as "fixed on HEAD" A new release should come soon-ish