Description
According to the documentation, docker compose will fail if a dependency is deactivated through an inactive profile:
# this will fail because profile "dev" is disabled
$ docker compose up phpmyadmin
However in practice, docker compose will successfully start and not even print an error or warning (it "fails to fail").
Steps to reproduce the issue:
- Create the following docker-compose.yml
services:
foo:
image: hello-world
profiles: ["foo"]
bar:
image: hello-world
depends_on:
foo:
condition: service_completed_successfully
docker compose up
Describe the results you received:
docker compose will just silently execute service "bar":
$ docker compose up
[+] Running 1/0
⠿ Container test-bar-1 Created 0.1s
Attaching to test-bar-1
test-bar-1 |
test-bar-1 | Hello from Docker!
test-bar-1 | This message shows that your installation appears to be working correctly.
test-bar-1 |
test-bar-1 | To generate this message, Docker took the following steps:
test-bar-1 | 1. The Docker client contacted the Docker daemon.
test-bar-1 | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
test-bar-1 | (amd64)
test-bar-1 | 3. The Docker daemon created a new container from that image which runs the
test-bar-1 | executable that produces the output you are currently reading.
test-bar-1 | 4. The Docker daemon streamed that output to the Docker client, which sent it
test-bar-1 | to your terminal.
test-bar-1 |
test-bar-1 | To try something more ambitious, you can run an Ubuntu container with:
test-bar-1 | $ docker run -it ubuntu bash
test-bar-1 |
test-bar-1 | Share images, automate workflows, and more with a free Docker ID:
test-bar-1 | https://hub.docker.com/
test-bar-1 |
test-bar-1 | For more examples and ideas, visit:
test-bar-1 | https://docs.docker.com/get-started/
test-bar-1 |
test-bar-1 exited with code 0
Describe the results you expected:
According to the docs, I expected a failure, which I interpret as preferably docker compose not starting at all but instead exiting with an error message, or at least if it does start it should print an error message. Alternatively it could automatically start foo but that seems to be not intended according to the docs.
Output of docker compose version:
Docker Compose version 2.10.2
Output of docker info:
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
compose: Docker Compose (Docker Inc., 2.10.2)
Server:
Containers: 175
Running: 0
Paused: 0
Stopped: 175
Images: 249
Server Version: 20.10.17
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: false
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 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.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: default
cgroupns
Kernel Version: 5.19.2-arch1-1
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 20
Total Memory: 46.97GiB
Name: konradsdesktop
ID: 3NEP:3UOO:RVV3:RCWK:44GY:N4UB:ZIRE:2BN7:KSBI:CMZG:5KFU:YRPN
Docker Root Dir: /home/konrad/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Description
According to the documentation, docker compose will fail if a dependency is deactivated through an inactive profile:
However in practice, docker compose will successfully start and not even print an error or warning (it "fails to fail").
Steps to reproduce the issue:
docker compose upDescribe the results you received:
docker compose will just silently execute service "bar":
Describe the results you expected:
According to the docs, I expected a failure, which I interpret as preferably docker compose not starting at all but instead exiting with an error message, or at least if it does start it should print an error message. Alternatively it could automatically start foo but that seems to be not intended according to the docs.
Output of
docker compose version:Output of
docker info: