Description
docker compose config no longer populates the environment attribute with values from an env file.
This change broke a few of our deployment pipelines, since we prefer to ship only the compose file generated by the config command, rather than shipping the compose file and the env file.
Is there any way to get this old behavior back?
Steps To Reproduce
given these two files:
foo.yml:
services:
foo_serv:
image: debian:latest
env_file:
- foo.env
and foo.env:
prior to v2.24.7 we were able to run docker compose --file foo.yml config and get the following output:
name: foo
services:
foo_serv:
environment:
BAR: baz
FOO: bar
image: debian:latest
networks:
default: null
networks:
default:
name: foo_default
notice the environment attribute is populated with our environment variables from the env file. This allowed us to ship a single compose file with all of our env vars defined.
However, since compose 2.24.7, we get this output:
name: foo
networks:
default:
name: foo_default
services:
foo_serv:
env_file:
- path: /home/er0k/tmp/foo/foo.env
required: true
image: debian:latest
networks:
default: null
it no longer populates the environment attribute at all, instead we have the env_file attribute that points to the env file.
Compose Version
Docker Compose version v2.24.7
Docker Environment
Client: Docker Engine - Community
Version: 26.0.0-rc2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.13.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.24.7
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 11
Running: 1
Paused: 0
Stopped: 10
Images: 13
Server Version: 26.0.0-rc2
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
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: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.3.0-1-amd64
Operating System: Debian GNU/Linux trixie/sid
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.5GiB
Name: bop
ID: e5ba45ff-ae7e-440a-a01b-677210894d57
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
Description
docker compose configno longer populates theenvironmentattribute with values from an env file.This change broke a few of our deployment pipelines, since we prefer to ship only the compose file generated by the
configcommand, rather than shipping the compose file and the env file.Is there any way to get this old behavior back?
Steps To Reproduce
given these two files:
foo.yml:and
foo.env:prior to v2.24.7 we were able to run
docker compose --file foo.yml configand get the following output:notice the
environmentattribute is populated with our environment variables from the env file. This allowed us to ship a single compose file with all of our env vars defined.However, since compose 2.24.7, we get this output:
it no longer populates the
environmentattribute at all, instead we have theenv_fileattribute that points to the env file.Compose Version
Docker Environment
Anything else?
No response