Closed
Description
Description
I'm migrating from compose v1 to v2 and I noticed that COMPOSE_PROFILES=all
in .env
now seems to take precedence over --profile
on the command line.
Is this intentional? If yes then it makes my setup more awkward to use:
COMPOSE_PROFILES=all
in.env
- all services are in profile
all
(some services are not in other profiles that shall be selectable on demand) - with v1, users can choose another subset of services via
docker-compose --profile x ...
- with v2, I now have to use
COMPOSE_PROFILES=x docker compose ...
as--profile
doesn’t work anymore (until I removeCOMPOSE_PROFILES
from.env
)
Steps to reproduce the issue:
- create a compose setup with one service
- add the service to profile
all
- create
.env
containingCOMPOSE_PROFILES=all
docker compose --profile x up -d
PS: This is a minimalist reproducer. In my actual project I have ~10 services and 3 profiles, all
being one of them.
Describe the results you received:
Service is started.
Describe the results you expected:
Service is not started since it's not in profile x
.
Additional information you deem important (e.g. issue happens only occasionally):
n/a
Output of docker compose version
:
Docker Compose version v2.10.2
Output of docker info
:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.9.1)
compose: Docker Compose (Docker Inc., v2.10.2)
extension: Manages Docker extensions (Docker Inc., v0.2.9)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.19.0)
Server:
Containers: 31
Running: 21
Paused: 0
Stopped: 10
Images: 59
Server Version: 20.10.17
Storage Driver: overlay2
Backing Filesystem: extfs
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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.102.1-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 50.05GiB
Name: docker-desktop
ID: UP6R:7I2A:YZRF:GJXT:HP5O:BIHU:L4G5:NDSE:W36S:6VJ2:FL5X:WO7N
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal,localhost,.mms-at-work.de,.mms-t-systems.de,.t-systems-mms.eu,127.0.0.0/8,192.168.0.0/16
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5000
127.0.0.0/8
Registry Mirrors:
https://common-docker.artifacts.mms-at-work.de/
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
Additional environment details:
WSL2, but same on Linux client or in native Windows.