Skip to content

[BUG] build --push attempts to push images for services without image defined #10813

@milas

Description

@milas

Description

If a service does not have an image field, Compose generates a default image name in the format $project-$service. This should never be attempted to be pushed, as it'll always fail, since it implicitly resolves to docker.io/library/$project-$service.

Steps To Reproduce

compose.yaml

services:
  app:
    build: .

Dockerfile

FROM alpine
  1. Run docker compose build --push
 => [app] exporting to image                                                                                                                          0.0s
 => => exporting layers                                                                                                                               0.0s
 => => writing image sha256:b247771ad3b311c4fc85551871712e872e34c5319c2c23b955b200375f994ec0                                                          0.0s
 => => naming to docker.io/library/build-app                                                                                                          0.0s
 => ERROR [app] pushing build-app with docker                                                                                                         1.2s
 => => pushing layer 0a13d2aaa54c                                                                                                                     0.9s
 => => pushing layer 45437bbd87f2                                                                                                                     0.9s
 => => pushing layer 7cd1e5cbf124                                                                                                                     0.9s
 => => pushing layer ad6517b0c914                                                                                                                     0.9s
 => => pushing layer 4e6bef96e37e                                                                                                                     0.9s
 => => pushing layer c58d5a26ffa8                                                                                                                     1.0s
 => => pushing layer efd1965f1684                                                                                                                     1.0s
------
 > [app] pushing build-app with docker:
------
denied: requested access to the resource is denied

Compose Version

v2.20.0

Docker Environment

Occurs with all Engine versions

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