Skip to content

[BUG] Labels no longer created on build #13048

@kevin-vitro

Description

@kevin-vitro

Description

I was using these labels that docker compose automatically generated at least in compose v2.35.1
"com.docker.compose.project": "deploy",
"com.docker.compose.service": "deploy",
"com.docker.compose.version": "2.35.1",

As of 2.38.2, these labels no longer show up in Config.Labels section of our docker image. This negatively affects us because vs code docker management tools group based on the "com.docker.compose.project" so that is how I initially noticed this difference.

Steps To Reproduce

Using compose v2.35.1:

  1. Build a container using docker compose build
  2. Observe the labels using docker inspect {built_image_name}
    1. Specifically look at Config.Labels section
    2. Confirm the existence of:
      1. com.docker.compose.project
      2. com.docker.compose.service
      3. com.docker.compose.version

Repeat using compose v2.38.2 (I haven't tested on versions between these)

Minimal Reproducible Example:

Using the following files:
docker-compose.yml

services:
  test:
    build: .
    ports:
      - "8000:5000"

Dockerfile

FROM python:3.9-slim
CMD ["/bin/bash"]

run these commands:

docker compose -f docker-compose.yml build
docker inspect nbs-test

The name of the docker image may be different from nbs-test. nbs was the name of the parent folder where I was running this test.

Compose Version

2.38.2

Docker Environment

Client: Docker Engine - Community
 Version:    28.3.2
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.25.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.35.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose
  model: Docker Model Runner (EXPERIMENTAL) (Docker Inc.)
    Version:  v0.1.33
    Path:     /usr/libexec/docker/cli-plugins/docker-model
WARNING: Plugin "/usr/libexec/docker/cli-plugins/docker-compose_2_38_2" is not valid: plugin candidate "compose_2_38_2" did not match "^[a-z][a-z0-9]*$" 

Server:
 Containers: 35
  Running: 21
  Paused: 0
  Stopped: 14
 Images: 376
 Server Version: 28.3.2-1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  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 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: 05044ec0a9a75232cad458027ca83437aae3f4da
 runc version: bc20cb4497af9af01bea4a8044f1678ffca2745c
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-60-generic
 Operating System: Ubuntu 22.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 24
 Total Memory: 31.18GiB
 Name: vit-svi-dev-5
 ID: 2c622181-cad1-4e04-983a-b85b10179db9
 Docker Root Dir: /mnt
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

label_noissue_2.35.1.json this is where the issue does not occur. Labels look correct in this file.

label_issue_2.38.2.json #this is where the issue occurs. No labels show up in this file

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions