Skip to content

[BUG] COMPOSE_PROFILES ignored from --env-file in v2.27.1? #11856

@wjans

Description

@wjans

Description

We have an env file being used which contains COMPOSE_PROFILES, in earlier versions services containing one of these profiles are included, starting from version v2.27.1 services containing profiles are not included.

Steps To Reproduce

Env file:

$ cat my-env
COMPOSE_PROFILES=b-profile

Docker compose file:

$ cat docker-compose.yml
services:

  nginx-a:
    image: nginx

  nginx-b:
    image: nginx
    profiles: [ "b-profile" ]

Actual: output excludes nginx-b:

$ docker-compose --env-file my-env config
name: dockers
services:
  nginx-a:
    image: nginx
    networks:
      default: null
networks:
  default:
    name: dockers_default

Expected (when using v2.27.0-desktop.2 for instance):

$ docker-compose --env-file my-env config
name: dockers
services:
  nginx-a:
    image: nginx
    networks:
      default: null
  nginx-b:
    profiles:
      - b-profile
    image: nginx
    networks:
      default: null
networks:
  default:
    name: dockers_default

Compose Version

Docker Compose version v2.27.1

Docker Environment

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.0.0+unknown)

Server:
 Containers: 58
  Running: 56
  Paused: 0
  Stopped: 2
 Images: 42
 Server Version: 20.10.25
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 64b8a811b07ba6288238eefc14d898ee0b5b99ba
 runc version: 4bccb38cc9cf198d52bebf2b3a90cd14e7af8c06
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.14.318-241.531.amzn2.x86_64
 Operating System: Amazon Linux 2
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.4GiB
 Name: ip-172-31-42-170.eu-central-1.compute.internal
 ID: 3ZHP:FNGL:KNFJ:T2BX:GGTW:MLX4:WFWZ:4FAL:G6WZ:652D:KDMI:J7GS
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

When using COMPOSE_PROFILES within the docker-compose.yml it does get filled in properly. When setting as an environment variable or in the default .env file, it does work.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions