Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] config no longer builds environment attribute in 2.24.7 #11598

Closed
er0k opened this issue Mar 11, 2024 · 2 comments
Closed

[BUG] config no longer builds environment attribute in 2.24.7 #11598

er0k opened this issue Mar 11, 2024 · 2 comments

Comments

@er0k
Copy link

er0k commented Mar 11, 2024

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:

FOO=bar
BAR=baz

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

@ndeloof
Copy link
Contributor

ndeloof commented Mar 13, 2024

fixed by #11604

@ndeloof ndeloof closed this as completed Mar 13, 2024
@luciangabor
Copy link

The fix seems to fix #11591 too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants