Skip to content

[BUG] Unhelpful warning "No services to build" with docker compose up #13484

@snowdroppe

Description

@snowdroppe

Description

Commit c89b8a2 added a warning log "No services to build" when build is run without any services to build.

This also affects docker compose up even if no build directive exists within docker-compose.yml. Running up without the image present in the platform cache (and pull_policy: missing, which is default if unset), results in a pull from the image directive (if possible) and starts the container(s).

Subsequent runs of up with a cached image result in the unhelpful (albeit accurate) warning message "WARN[0000] No services to build".

I imagine this behaviour is due to compose running build as a fallback to pull, even if the image is cached and --build not specified.

Running docker compose up --no-build results in no warning as expected, but I would expect this to be default behaviour if --build is not specified and no build directive exists.

Obviously, pre 5.0 behaviour had no such warning (even if the internal calls to build were identical).

Steps To Reproduce

docker-compose.yml:

services:
  app:
    image: hello-world:latest
  1. docker compose up (assuming the image is not cached)
root@host /srv/myapp # docker compose up
[+] up 0/2
[+] up 4/4ello-world:latest [⠀] Pulling                                                                                                                                                                 2.0s
 ✔ Image hello-world:latest Pulled                                                                                                                                                                      2.1s
   ✔ 17eec7bbc9d7           Pull complete                                                                                                                                                               0.5s
 ✔ Network myapp_default    Created                                                                                                                                                                     0.0s
 ✔ Container myapp-app-1    Created                                                                                                                                                                     0.0s
Attaching to app-1
app-1  |
app-1  | Hello from Docker!
app-1  | This message shows that your installation appears to be working correctly.
...
  1. docker compose up (assuming the image is cached)
root@host /srv/myapp # docker compose up
WARN[0000] No services to build
Attaching to app-1
app-1  |
app-1  | Hello from Docker!
app-1  | This message shows that your installation appears to be working correctly.
...

Compose Version

Docker Compose version 5.0.1

Docker Environment

Client:
 Version:    29.1.3
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  5.0.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 29.1.3
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  userxattr: false
 Logging Driver: local
 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 splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 75cb2b7193e4e490e9fbdc236c0e811ccaba3376.m
 runc version:
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.16.8-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.749GiB
 Name: host
 ID: affaf1ab-b8ff-4f55-8bf3-cd402c21bad6
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Firewall Backend: iptables

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions