Skip to content

Docker compose config with profiles hangs indefinitely when combining "--no-interpolate" and "--resolve-image-digests" #11812

@b-enigma-con

Description

@b-enigma-con

Description

Using DevOps build pipeline task "dockercompose@0", the task hangs indefinitely when resolving image digests without interpolation using profiles, and one or more of the services is being excluded by means of profiles.

microsoft/azure-pipelines-tasks#17808 (comment)

Steps To Reproduce

Add task "dockercompose@0" to a DevOps build pipeline. Because task "dockercompose@0" uses outdated "docker-compose" (instead of "docker compose"), apply the following fix (define a docker compose path):
microsoft/azure-pipelines-tasks#17808 (comment)

  # variables
  compose_profiles: dev

  - task: DockerCompose@0
    displayName: Resolve image digests without interpolation
    inputs:
      action: Run a Docker Compose command
      containerregistrytype: 'Container Registry'
      dockerComposeFile: $(dockerComposeFile)
      projectName: $(registry_namespace)
      arguments: --no-interpolate --resolve-image-digests --output docker-compose.image-digests.yml
      dockerComposeCommand: config 
      dockerComposePath: $(dockerComposePath)

Create a docker compose file with 2 services and apply profiles, such as

services:
  sqlserver:
    container_name: sqlserver
    profiles: 
        - dev
        - production
    image: mcr.microsoft.com/mssql/server
    ports:
      - 998:1433
    environment:
      ACCEPT_EULA: "Y"
      MSSQL_SA_PASSWORD: ${MSSQL_SA_PASSWORD}

  workerservice:
    container_name: workerservice
    profiles: 
        - production
    image: ${DOCKER_REGISTRY-}/workerservice

Service "workerservice" is excluded when applying profile "dev". This seems to cause the build pipeline task to hang indefinitely.

The command that is created by the task looks like:
/usr/libexec/docker/cli-plugins/docker-compose -f /[snip]/docker-compose.yml -f /[snip]/.docker-compose.1715583828579.yml -p projectname config --no-interpolate --resolve-image-digests --output docker-compose.test.yml

Compose Version

docker compose version: Docker Compose version v2.25.0
docker-compose version: Command 'docker-compose' not found

Docker Environment

Client: Docker Engine - Community
 Version:    26.0.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.13.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.25.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 6
  Running: 2
  Paused: 0
  Stopped: 4
 Images: 10
 Server Version: 26.0.0
 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
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-106-generic
 Operating System: Ubuntu 22.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 3.754GiB
 Name: cnz-t-dock01
 ID: 51904811-1719-44bc-abc0-45db59750e10
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  192.168.14.58:5000
  127.0.0.0/8
 Live Restore Enabled: false

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