Skip to content

[BUG] Secrets not loading from .env file #11941

@ollipa

Description

@ollipa

Description

Previously in version v2.27.1 this worked:

In .env:

MY_SECRET=very_secret

In docker compose yaml:

secrets:
  MY_SECRET:
    environment: MY_SECRET

However in after updating to v2.28.1 the secret is not loaded correctly from .env file anymore causing builds that rely on the secret to fail.

Steps To Reproduce

Define a secret in .env file and try to use it in docker compose.

Compose Version

Docker Compose version v2.28.1

Docker Environment

Client: Docker Engine - Community                                               
 Version:    27.0.2                                                             
 Context:    default                                                            
 Debug Mode: false                                                              
 Plugins:                                                                       
  buildx: Docker Buildx (Docker Inc.)                                           
    Version:  v0.15.1                                                           
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx                     
  compose: Docker Compose (Docker Inc.)                                         
    Version:  v2.28.1                                                           
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions