Skip to content

[BUG] Setting environment and env_file service attributes #12706

@wray27

Description

@wray27

Description

The environment variables under env_file are ignored. When environment variables are set under the environment attribute.

Related issue on stack overflow

This was working on Docker Compose version 2.28.1

Steps To Reproduce

  1. Running on M1 Mac
  2. docker-compose version 2.34.0, docker version 28.0.4
.env

FRUIT=APPLE

---
docker-compose.yml

my-service: 
    image: python:3.13.2-alpine3.21
    env_file:
      - .env
    environment:
      TZ: Europe/London
  1. In a directory running - dcp run my-service. The environment variables in .env are ignored. The environment variables set under the environment are there.

What I expect is for the environemnt variables to be interpolated so that they all exist.

Compose Version

docker-compose version 2.34.0

Docker Environment

docker version 28.0.4

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions