Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker_compose_v2 fails with "Error when processing ${container_name}: Error" #807

Closed
mabeett opened this issue Feb 25, 2024 · 4 comments · Fixed by #810
Closed

docker_compose_v2 fails with "Error when processing ${container_name}: Error" #807

mabeett opened this issue Feb 25, 2024 · 4 comments · Fixed by #810
Labels
bug Something isn't working docker-compose-v2 Docker Compose v2

Comments

@mabeett
Copy link

mabeett commented Feb 25, 2024

SUMMARY

Define a compose project with two or more services using the same image which needs to be built.
Invoke community.docker.docker_compose_v2 scaling one of the services, not the other.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.docker.docker_compose_v2

ANSIBLE VERSION
$ ansible --version
ansible [core 2.16.3]
  config file = None
  configured module search path = ['/home/ubuntu/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.11/dist-packages/ansible
  ansible collection location = /home/ubuntu/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.8 (main, Feb  7 2024, 21:52:08) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
$ ansible-galaxy collection list community.docker

# /usr/local/lib/python3.11/dist-packages/ansible_collections
Collection       Version
---------------- -------
community.docker 3.7.0  

CONFIGURATION
$ ansible-config dump --only-changed
CONFIG_FILE() = None
OS / ENVIRONMENT
$ docker --version 
Docker version 25.0.3, build 4debf41
STEPS TO REPRODUCE

FIXME

#!/usr/bin/env ansible-playbook

---
- hosts: all
  gather_facts: yes
  vars:
   - project_dir: "{{ ansible_user_dir }}/test"

  tasks:
  - name: Create a directory if it does not exist
    ansible.builtin.file:
      path: "{{ item }}"
      state: directory
      mode: '0755'
    with_items:
       - "{{ project_dir }}/dummy/"
       - "{{ project_dir }}/dummy2/"
  - name: Dockerfile for dummy
    ansible.builtin.copy:
      content: |
        FROM nginx:latest
        
        RUN date > file
        RUN date > file2
        RUN date > file3
        RUN touch foo
      dest:  "{{ project_dir }}/dummy/Dockerfile"
  - name: Dockerfile for dummy2
    ansible.builtin.copy:
      content: |
        FROM httpd:latest
        
        RUN date > file4
        RUN date > file5
        RUN date > file6
        RUN touch foo
      dest:  "{{ project_dir }}/dummy2/Dockerfile"
  - name: docker-compose
    ansible.builtin.copy:
      content: |
        version: '3'
        services:
          dummy3:
            build:
              context: ./dummy
            image: 'dummy'
            container_name: dummy
            restart: always
          dummy2:
            build:
              context: ./dummy2
            image: 'dummy2'
            container_name: dummy2
            restart: always
          dummy:
            image: 'dummy2'
            container_name: dummy3
            restart: always
      dest:  "{{ project_dir }}/docker-compose.yml"
  - name: run docker compose up
    community.docker.docker_compose_v2:
      project_src: "{{ project_dir }}/"
      scale:
        dummy: 1
        dummy2: 0
        dummy3: 1 
    register: failer_job
    ignore_errors: yes
  - name: debug output for compose up
    ansible.builtin.debug:
      var: failer_job
  - name: clean containers and images
    ansible.builtin.shell:
      cmd: "{{ item }}"
      chdir: "{{ project_dir }}"
    with_items:
      - docker compose down
      - docker rmi dummy dummy2
      - docker builder prune -f
  - name: run docker compose up via shell
    ansible.builtin.shell:
      cmd: "{{ failer_job.cmd }}"
      chdir: "{{ project_dir }}"
  - name: clean containers and images
    ansible.builtin.shell:
      cmd: "{{ item }}"
      chdir: "{{ project_dir }}"
    with_items:
      - docker compose down
      - docker rmi dummy dummy2
      - docker builder prune -f
  - name: run docker compose up
    community.docker.docker_compose_v2:
      project_src: "{{ project_dir }}/"
      scale:
        dummy: 1
        dummy2: 0
        dummy3: 1 
EXPECTED RESULTS

community.docker.docker_compose_v2 should not fail and/or manage the root cause of the error.

From what I understand the problem might be linked with the stderr output, see in the snippet below:

[...]
 dummy2 Warning 
 dummy Error 
 Network test_default  Creating
[...]
ACTUAL RESULTS

community.docker.docker_compose_v2 fails giving:

  • "failed": true,
  • "msg": "Error when processing dummy: Error"
    but also returns:
  • "rc": 0

After the failure the target system has the services up as expected, I cannot find docker logs about the supposed error.

If the user the same docker compose up of the module via shell in the same conditions ( see example playbook ) the shell does not fail..

{
  "actions": [
    {
      "id": "dummy2",
      "status": "Pulling",
      "what": "service"
    },
    {
      "id": "dummy",
      "status": "Pulling",
      "what": "service"
    },
    {
      "id": "dummy3",
      "status": "Pulling",
      "what": "service"
    },
    {
      "id": "test_default",
      "status": "Creating",
      "what": "network"
    },
    {
      "id": "dummy3",
      "status": "Creating",
      "what": "container"
    },
    {
      "id": "dummy",
      "status": "Creating",
      "what": "container"
    },
    {
      "id": "dummy3",
      "status": "Starting",
      "what": "container"
    },
    {
      "id": "dummy",
      "status": "Starting",
      "what": "container"
    }
  ],
  "changed": true,
  "cmd": "/usr/bin/docker compose --ansi never --progress plain --project-directory /home/debian/test/ up --detach --no-color --quiet-pull --scale dummy=1 --scale dummy2=0 --scale dummy3=1 --",
  "containers": [
    {
      "Command": "\"/docker-entrypoint.sh nginx -g 'daemon off;'\"",
      "CreatedAt": "2024-02-25 20:34:26 +0000 UTC",
      "ExitCode": 0,
      "Health": "",
      "ID": "3b5b875658415e00ba5d8306b948d24844662d256346cabfa4e861731e8e4182",
      "Image": "dummy",
      "Labels": {
        "com.docker.compose.config-hash": "819f021809179cd2c8da2e3331ddd695a84020e8f3255216f520ab80970ea256",
        "com.docker.compose.container-number": "1",
        "com.docker.compose.depends_on": "",
        "com.docker.compose.image": "sha256:a6b78b7fa183a2cce1541fd0353741f3f041a4df9c9de95da9d9a94329bf6cc8",
        "com.docker.compose.oneoff": "False",
        "com.docker.compose.project": "test",
        "com.docker.compose.project.config_files": "/home/debian/test/docker-compose.yml",
        "com.docker.compose.project.working_dir": "/home/debian/test",
        "com.docker.compose.service": "dummy3",
        "com.docker.compose.version": "2.24.5",
        "maintainer": "NGINX Docker Maintainers <[email protected]>"
      },
      "LocalVolumes": "0",
      "Mounts": "",
      "Name": "dummy",
      "Names": [
        "dummy"
      ],
      "Networks": [
        "test_default"
      ],
      "Ports": "80/tcp",
      "Project": "test",
      "Publishers": [
        {
          "Protocol": "tcp",
          "PublishedPort": 0,
          "TargetPort": 80,
          "URL": ""
        }
      ],
      "RunningFor": "Less than a second ago",
      "Service": "dummy3",
      "Size": "0B",
      "State": "running",
      "Status": "Up Less than a second"
    },
    {
      "Command": "\"httpd-foreground\"",
      "CreatedAt": "2024-02-25 20:34:26 +0000 UTC",
      "ExitCode": 0,
      "Health": "",
      "ID": "0ae30ada660120f02c516beb7535cb34b0b85917ca378741f787b7d0150c3080",
      "Image": "dummy2",
      "Labels": {
        "com.docker.compose.config-hash": "3a4a78e8dcb22032f804de4eac92e8c1b72df3dee70ecf6bad859d830cae1ab7",
        "com.docker.compose.container-number": "1",
        "com.docker.compose.depends_on": "",
        "com.docker.compose.image": "sha256:97066e13afd291fbe1a0da350b6b6c0f62c1df7c067bbdb0d76da367f6b3d3cf",
        "com.docker.compose.oneoff": "False",
        "com.docker.compose.project": "test",
        "com.docker.compose.project.config_files": "/home/debian/test/docker-compose.yml",
        "com.docker.compose.project.working_dir": "/home/debian/test",
        "com.docker.compose.service": "dummy",
        "com.docker.compose.version": "2.24.5"
      },
      "LocalVolumes": "0",
      "Mounts": "",
      "Name": "dummy3",
      "Names": [
        "dummy3"
      ],
      "Networks": [
        "test_default"
      ],
      "Ports": "80/tcp",
      "Project": "test",
      "Publishers": [
        {
          "Protocol": "tcp",
          "PublishedPort": 0,
          "TargetPort": 80,
          "URL": ""
        }
      ],
      "RunningFor": "Less than a second ago",
      "Service": "dummy",
      "Size": "0B",
      "State": "running",
      "Status": "Up Less than a second"
    }
  ],
  "images": [
    {
      "ContainerName": "dummy",
      "ID": "sha256:a6b78b7fa183a2cce1541fd0353741f3f041a4df9c9de95da9d9a94329bf6cc8",
      "Repository": "dummy",
      "Size": 186721090,
      "Tag": "latest"
    },
    {
      "ContainerName": "dummy3",
      "ID": "sha256:97066e13afd291fbe1a0da350b6b6c0f62c1df7c067bbdb0d76da367f6b3d3cf",
      "Repository": "dummy2",
      "Size": 167481559,
      "Tag": "latest"
    }
  ],
  "msg": "Error when processing dummy: Error",
  "rc": 0,
  "stderr": " dummy2 Pulling \n dummy Pulling \n dummy3 Pulling \n dummy3 Warning \n dummy2 Warning \n dummy Error \n Network test_default  Creating\n Network test_default  Created\n Container dummy3  Creating\n Container dummy  Creating\n Container dummy3  Created\n Container dummy  Created\n Container dummy3  Starting\n Container dummy  Starting\n Container dummy3  Started\n Container dummy  Started\n",
  "stderr_lines": [
    " dummy2 Pulling ",
    " dummy Pulling ",
    " dummy3 Pulling ",
    " dummy3 Warning ",
    " dummy2 Warning ",
    " dummy Error ",
    " Network test_default  Creating",
    " Network test_default  Created",
    " Container dummy3  Creating",
    " Container dummy  Creating",
    " Container dummy3  Created",
    " Container dummy  Created",
    " Container dummy3  Starting",
    " Container dummy  Starting",
    " Container dummy3  Started",
    " Container dummy  Started"
  ],
  "stdout": "#0 building with \"default\" instance using docker driver\n\n#1 [dummy3 internal] load build definition from Dockerfile\n#1 transferring dockerfile: 120B done\n#1 DONE 0.0s\n\n#2 [dummy2 internal] load build definition from Dockerfile\n#2 transferring dockerfile: 121B done\n#2 DONE 0.1s\n\n#3 [dummy2 internal] load metadata for docker.io/library/httpd:latest\n#3 ...\n\n#4 [dummy3 internal] load metadata for docker.io/library/nginx:latest\n#4 DONE 1.0s\n\n#5 [dummy3 internal] load .dockerignore\n#5 transferring context: 2B done\n#5 DONE 0.0s\n\n#3 [dummy2 internal] load metadata for docker.io/library/httpd:latest\n#3 DONE 1.1s\n\n#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107\n#6 resolve docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107 0.0s done\n#6 ...\n\n#7 [dummy2 internal] load .dockerignore\n#7 transferring context: 2B done\n#7 DONE 0.0s\n\n#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107\n#6 sha256:05aa73005987caaed48ea8213696b0df761ccd600d2c53fc0a1a97a180301d71 2.29kB / 2.29kB done\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 0B / 29.12MB 0.1s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 0B / 41.39MB 0.1s\n#6 sha256:c3ea3344e711fd7111dee02f17deebceb725ed1d0ee998f7fb472114dc1399ce 0B / 629B 0.1s\n#6 sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107 9.85kB / 9.85kB done\n#6 sha256:e4720093a3c1381245b53a5a51b417963b3c4472d3f47fc301930a4f3b17666a 7.04kB / 7.04kB done\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 2.10MB / 41.39MB 0.6s\n#6 sha256:c3ea3344e711fd7111dee02f17deebceb725ed1d0ee998f7fb472114dc1399ce 629B / 629B 0.6s\n#6 sha256:c3ea3344e711fd7111dee02f17deebceb725ed1d0ee998f7fb472114dc1399ce 629B / 629B 0.6s done\n#6 sha256:cc1bb4345a3a849289cfb3e2471c096f374423ec1ef74766137b9de546498612 0B / 957B 0.7s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 2.10MB / 29.12MB 1.0s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 5.24MB / 41.39MB 1.0s\n#6 sha256:cc1bb4345a3a849289cfb3e2471c096f374423ec1ef74766137b9de546498612 957B / 957B 1.0s done\n#6 sha256:da8fa4352481b358fc60d40ee20d92da64124d2cf405115640d45980339f47e5 0B / 394B 1.1s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 4.19MB / 29.12MB 1.3s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 7.34MB / 41.39MB 1.3s\n#6 sha256:da8fa4352481b358fc60d40ee20d92da64124d2cf405115640d45980339f47e5 394B / 394B 1.3s done\n#6 sha256:c7f80e9cdab20387cd09e3c47121ef0eb531043cf0aca1a52aab659de3ccb704 0B / 1.21kB 1.4s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 9.44MB / 41.39MB 1.6s\n#6 sha256:c7f80e9cdab20387cd09e3c47121ef0eb531043cf0aca1a52aab659de3ccb704 1.21kB / 1.21kB 1.6s done\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 6.29MB / 29.12MB 1.7s\n#6 sha256:18a869624cb60aaa916942dc71c22b194a078dcbbb9b8f54d40512eba55f70b8 0B / 1.40kB 1.7s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 8.39MB / 29.12MB 2.0s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 12.58MB / 41.39MB 2.0s\n#6 sha256:18a869624cb60aaa916942dc71c22b194a078dcbbb9b8f54d40512eba55f70b8 1.40kB / 1.40kB 1.8s done\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 10.49MB / 29.12MB 2.4s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 15.73MB / 41.39MB 2.4s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 12.58MB / 29.12MB 2.7s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 17.83MB / 41.39MB 2.9s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 14.68MB / 29.12MB 3.3s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 19.92MB / 41.39MB 3.3s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 16.78MB / 29.12MB 3.6s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 22.02MB / 41.39MB 3.7s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 18.87MB / 29.12MB 4.1s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 24.12MB / 41.39MB 4.1s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 26.21MB / 41.39MB 4.5s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 20.97MB / 29.12MB 4.6s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 28.31MB / 41.39MB 5.0s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 23.07MB / 29.12MB 5.1s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 30.41MB / 41.39MB 5.5s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 25.17MB / 29.12MB 5.6s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 32.51MB / 41.39MB 5.9s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 27.26MB / 29.12MB 6.0s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 34.60MB / 41.39MB 6.3s\n#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 29.12MB / 29.12MB 6.4s done\n#6 extracting sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 36.70MB / 41.39MB 6.6s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 38.80MB / 41.39MB 6.9s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 41.39MB / 41.39MB 7.2s\n#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 41.39MB / 41.39MB 7.3s done\n#6 extracting sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 2.4s done\n#6 extracting sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c\n#6 ...\n\n#8 [dummy2 1/5] FROM docker.io/library/httpd:latest@sha256:104f07de17ee186c8f37b9f561e04fbfe4cf080d78c6e5f3802fd08fd118c3da\n#8 resolve docker.io/library/httpd:latest@sha256:104f07de17ee186c8f37b9f561e04fbfe4cf080d78c6e5f3802fd08fd118c3da 0.0s done\n#8 sha256:104f07de17ee186c8f37b9f561e04fbfe4cf080d78c6e5f3802fd08fd118c3da 9.74kB / 9.74kB done\n#8 sha256:1ac0aa3c9710ece32eabf144250ca18cda19fdbe219ee8a56452846368f82858 2.10kB / 2.10kB done\n#8 sha256:2776f4da9d55d4071567d644338f5072a1a4e68cbffaa908e7e88e847223f51c 8.02kB / 8.02kB done\n#8 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 29.12MB / 29.12MB 6.2s done\n#8 sha256:87b0fe460fd97e9977ac8a0a2fe7a270d024e8d4fb9f71f423ea7aff6eef3e28 144B / 144B 1.9s done\n#8 sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B 2.1s done\n#8 sha256:9cebd3e3b5233a7cf99ee5853b6fbe9e68cb183b7c8ead5d50a88a0536555fcc 4.20MB / 4.20MB 3.0s done\n#8 sha256:e9304da947c5e9370b81b929a1f90af2a6d0ca3b668618547ea7a2d75c896610 31.20MB / 31.20MB 7.9s done\n#8 extracting sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 2.4s done\n#8 sha256:b60d4b66b268ff32a89991c974dbe2c9d8cbbe9deed52983682e69bae9d02b85 291B / 291B 6.4s done\n#8 extracting sha256:87b0fe460fd97e9977ac8a0a2fe7a270d024e8d4fb9f71f423ea7aff6eef3e28 done\n#8 extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 done\n#8 extracting sha256:9cebd3e3b5233a7cf99ee5853b6fbe9e68cb183b7c8ead5d50a88a0536555fcc 0.4s done\n#8 extracting sha256:e9304da947c5e9370b81b929a1f90af2a6d0ca3b668618547ea7a2d75c896610 0.4s\n#8 ...\n\n#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107\n#6 ...\n\n#8 [dummy2 1/5] FROM docker.io/library/httpd:latest@sha256:104f07de17ee186c8f37b9f561e04fbfe4cf080d78c6e5f3802fd08fd118c3da\n#8 extracting sha256:e9304da947c5e9370b81b929a1f90af2a6d0ca3b668618547ea7a2d75c896610 3.2s done\n#8 extracting sha256:b60d4b66b268ff32a89991c974dbe2c9d8cbbe9deed52983682e69bae9d02b85 done\n#8 DONE 13.2s\n\n#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107\n#6 extracting sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 4.5s done\n#6 extracting sha256:c3ea3344e711fd7111dee02f17deebceb725ed1d0ee998f7fb472114dc1399ce done\n#6 ...\n\n#9 [dummy2 2/5] RUN date > file4\n#9 DONE 0.5s\n\n#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107\n#6 extracting sha256:cc1bb4345a3a849289cfb3e2471c096f374423ec1ef74766137b9de546498612 done\n#6 extracting sha256:da8fa4352481b358fc60d40ee20d92da64124d2cf405115640d45980339f47e5 done\n#6 extracting sha256:c7f80e9cdab20387cd09e3c47121ef0eb531043cf0aca1a52aab659de3ccb704 done\n#6 extracting sha256:18a869624cb60aaa916942dc71c22b194a078dcbbb9b8f54d40512eba55f70b8\n#6 extracting sha256:18a869624cb60aaa916942dc71c22b194a078dcbbb9b8f54d40512eba55f70b8 done\n#6 ...\n\n#10 [dummy2 3/5] RUN date > file5\n#10 DONE 0.3s\n\n#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107\n#6 DONE 14.2s\n\n#11 [dummy3 2/5] RUN date > file\n#11 DONE 0.4s\n\n#12 [dummy2 4/5] RUN date > file6\n#12 DONE 0.5s\n\n#13 [dummy2 5/5] RUN touch foo\n#13 ...\n\n#14 [dummy3 3/5] RUN date > file2\n#14 DONE 0.6s\n\n#13 [dummy2 5/5] RUN touch foo\n#13 DONE 0.6s\n\n#15 [dummy2] exporting to image\n#15 exporting layers\n#15 exporting layers 0.2s done\n#15 writing image sha256:97066e13afd291fbe1a0da350b6b6c0f62c1df7c067bbdb0d76da367f6b3d3cf\n#15 writing image sha256:97066e13afd291fbe1a0da350b6b6c0f62c1df7c067bbdb0d76da367f6b3d3cf done\n#15 naming to docker.io/library/dummy2 done\n#15 DONE 0.2s\n\n#16 [dummy3 4/5] RUN date > file3\n#16 DONE 0.5s\n\n#17 [dummy3 5/5] RUN touch foo\n#17 DONE 0.3s\n\n#18 [dummy3] exporting to image\n#18 exporting layers 0.1s done\n#18 writing image sha256:a6b78b7fa183a2cce1541fd0353741f3f041a4df9c9de95da9d9a94329bf6cc8 done\n#18 naming to docker.io/library/dummy done\n#18 DONE 0.1s\n",
  "stdout_lines": [
    "#0 building with \"default\" instance using docker driver",
    "",
    "#1 [dummy3 internal] load build definition from Dockerfile",
    "#1 transferring dockerfile: 120B done",
    "#1 DONE 0.0s",
    "",
    "#2 [dummy2 internal] load build definition from Dockerfile",
    "#2 transferring dockerfile: 121B done",
    "#2 DONE 0.1s",
    "",
    "#3 [dummy2 internal] load metadata for docker.io/library/httpd:latest",
    "#3 ...",
    "",
    "#4 [dummy3 internal] load metadata for docker.io/library/nginx:latest",
    "#4 DONE 1.0s",
    "",
    "#5 [dummy3 internal] load .dockerignore",
    "#5 transferring context: 2B done",
    "#5 DONE 0.0s",
    "",
    "#3 [dummy2 internal] load metadata for docker.io/library/httpd:latest",
    "#3 DONE 1.1s",
    "",
    "#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107",
    "#6 resolve docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107 0.0s done",
    "#6 ...",
    "",
    "#7 [dummy2 internal] load .dockerignore",
    "#7 transferring context: 2B done",
    "#7 DONE 0.0s",
    "",
    "#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107",
    "#6 sha256:05aa73005987caaed48ea8213696b0df761ccd600d2c53fc0a1a97a180301d71 2.29kB / 2.29kB done",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 0B / 29.12MB 0.1s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 0B / 41.39MB 0.1s",
    "#6 sha256:c3ea3344e711fd7111dee02f17deebceb725ed1d0ee998f7fb472114dc1399ce 0B / 629B 0.1s",
    "#6 sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107 9.85kB / 9.85kB done",
    "#6 sha256:e4720093a3c1381245b53a5a51b417963b3c4472d3f47fc301930a4f3b17666a 7.04kB / 7.04kB done",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 2.10MB / 41.39MB 0.6s",
    "#6 sha256:c3ea3344e711fd7111dee02f17deebceb725ed1d0ee998f7fb472114dc1399ce 629B / 629B 0.6s",
    "#6 sha256:c3ea3344e711fd7111dee02f17deebceb725ed1d0ee998f7fb472114dc1399ce 629B / 629B 0.6s done",
    "#6 sha256:cc1bb4345a3a849289cfb3e2471c096f374423ec1ef74766137b9de546498612 0B / 957B 0.7s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 2.10MB / 29.12MB 1.0s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 5.24MB / 41.39MB 1.0s",
    "#6 sha256:cc1bb4345a3a849289cfb3e2471c096f374423ec1ef74766137b9de546498612 957B / 957B 1.0s done",
    "#6 sha256:da8fa4352481b358fc60d40ee20d92da64124d2cf405115640d45980339f47e5 0B / 394B 1.1s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 4.19MB / 29.12MB 1.3s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 7.34MB / 41.39MB 1.3s",
    "#6 sha256:da8fa4352481b358fc60d40ee20d92da64124d2cf405115640d45980339f47e5 394B / 394B 1.3s done",
    "#6 sha256:c7f80e9cdab20387cd09e3c47121ef0eb531043cf0aca1a52aab659de3ccb704 0B / 1.21kB 1.4s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 9.44MB / 41.39MB 1.6s",
    "#6 sha256:c7f80e9cdab20387cd09e3c47121ef0eb531043cf0aca1a52aab659de3ccb704 1.21kB / 1.21kB 1.6s done",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 6.29MB / 29.12MB 1.7s",
    "#6 sha256:18a869624cb60aaa916942dc71c22b194a078dcbbb9b8f54d40512eba55f70b8 0B / 1.40kB 1.7s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 8.39MB / 29.12MB 2.0s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 12.58MB / 41.39MB 2.0s",
    "#6 sha256:18a869624cb60aaa916942dc71c22b194a078dcbbb9b8f54d40512eba55f70b8 1.40kB / 1.40kB 1.8s done",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 10.49MB / 29.12MB 2.4s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 15.73MB / 41.39MB 2.4s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 12.58MB / 29.12MB 2.7s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 17.83MB / 41.39MB 2.9s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 14.68MB / 29.12MB 3.3s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 19.92MB / 41.39MB 3.3s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 16.78MB / 29.12MB 3.6s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 22.02MB / 41.39MB 3.7s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 18.87MB / 29.12MB 4.1s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 24.12MB / 41.39MB 4.1s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 26.21MB / 41.39MB 4.5s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 20.97MB / 29.12MB 4.6s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 28.31MB / 41.39MB 5.0s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 23.07MB / 29.12MB 5.1s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 30.41MB / 41.39MB 5.5s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 25.17MB / 29.12MB 5.6s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 32.51MB / 41.39MB 5.9s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 27.26MB / 29.12MB 6.0s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 34.60MB / 41.39MB 6.3s",
    "#6 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 29.12MB / 29.12MB 6.4s done",
    "#6 extracting sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 36.70MB / 41.39MB 6.6s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 38.80MB / 41.39MB 6.9s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 41.39MB / 41.39MB 7.2s",
    "#6 sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 41.39MB / 41.39MB 7.3s done",
    "#6 extracting sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 2.4s done",
    "#6 extracting sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c",
    "#6 ...",
    "",
    "#8 [dummy2 1/5] FROM docker.io/library/httpd:latest@sha256:104f07de17ee186c8f37b9f561e04fbfe4cf080d78c6e5f3802fd08fd118c3da",
    "#8 resolve docker.io/library/httpd:latest@sha256:104f07de17ee186c8f37b9f561e04fbfe4cf080d78c6e5f3802fd08fd118c3da 0.0s done",
    "#8 sha256:104f07de17ee186c8f37b9f561e04fbfe4cf080d78c6e5f3802fd08fd118c3da 9.74kB / 9.74kB done",
    "#8 sha256:1ac0aa3c9710ece32eabf144250ca18cda19fdbe219ee8a56452846368f82858 2.10kB / 2.10kB done",
    "#8 sha256:2776f4da9d55d4071567d644338f5072a1a4e68cbffaa908e7e88e847223f51c 8.02kB / 8.02kB done",
    "#8 sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 29.12MB / 29.12MB 6.2s done",
    "#8 sha256:87b0fe460fd97e9977ac8a0a2fe7a270d024e8d4fb9f71f423ea7aff6eef3e28 144B / 144B 1.9s done",
    "#8 sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B 2.1s done",
    "#8 sha256:9cebd3e3b5233a7cf99ee5853b6fbe9e68cb183b7c8ead5d50a88a0536555fcc 4.20MB / 4.20MB 3.0s done",
    "#8 sha256:e9304da947c5e9370b81b929a1f90af2a6d0ca3b668618547ea7a2d75c896610 31.20MB / 31.20MB 7.9s done",
    "#8 extracting sha256:e1caac4eb9d2ec24aa3618e5992208321a92492aef5fef5eb9e470895f771c56 2.4s done",
    "#8 sha256:b60d4b66b268ff32a89991c974dbe2c9d8cbbe9deed52983682e69bae9d02b85 291B / 291B 6.4s done",
    "#8 extracting sha256:87b0fe460fd97e9977ac8a0a2fe7a270d024e8d4fb9f71f423ea7aff6eef3e28 done",
    "#8 extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 done",
    "#8 extracting sha256:9cebd3e3b5233a7cf99ee5853b6fbe9e68cb183b7c8ead5d50a88a0536555fcc 0.4s done",
    "#8 extracting sha256:e9304da947c5e9370b81b929a1f90af2a6d0ca3b668618547ea7a2d75c896610 0.4s",
    "#8 ...",
    "",
    "#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107",
    "#6 ...",
    "",
    "#8 [dummy2 1/5] FROM docker.io/library/httpd:latest@sha256:104f07de17ee186c8f37b9f561e04fbfe4cf080d78c6e5f3802fd08fd118c3da",
    "#8 extracting sha256:e9304da947c5e9370b81b929a1f90af2a6d0ca3b668618547ea7a2d75c896610 3.2s done",
    "#8 extracting sha256:b60d4b66b268ff32a89991c974dbe2c9d8cbbe9deed52983682e69bae9d02b85 done",
    "#8 DONE 13.2s",
    "",
    "#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107",
    "#6 extracting sha256:88f6f236f401ac07aa5309d8ade2b0c9d24b9f526bd4e73311bf5c1787cfd49c 4.5s done",
    "#6 extracting sha256:c3ea3344e711fd7111dee02f17deebceb725ed1d0ee998f7fb472114dc1399ce done",
    "#6 ...",
    "",
    "#9 [dummy2 2/5] RUN date > file4",
    "#9 DONE 0.5s",
    "",
    "#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107",
    "#6 extracting sha256:cc1bb4345a3a849289cfb3e2471c096f374423ec1ef74766137b9de546498612 done",
    "#6 extracting sha256:da8fa4352481b358fc60d40ee20d92da64124d2cf405115640d45980339f47e5 done",
    "#6 extracting sha256:c7f80e9cdab20387cd09e3c47121ef0eb531043cf0aca1a52aab659de3ccb704 done",
    "#6 extracting sha256:18a869624cb60aaa916942dc71c22b194a078dcbbb9b8f54d40512eba55f70b8",
    "#6 extracting sha256:18a869624cb60aaa916942dc71c22b194a078dcbbb9b8f54d40512eba55f70b8 done",
    "#6 ...",
    "",
    "#10 [dummy2 3/5] RUN date > file5",
    "#10 DONE 0.3s",
    "",
    "#6 [dummy3 1/5] FROM docker.io/library/nginx:latest@sha256:c26ae7472d624ba1fafd296e73cecc4f93f853088e6a9c13c0d52f6ca5865107",
    "#6 DONE 14.2s",
    "",
    "#11 [dummy3 2/5] RUN date > file",
    "#11 DONE 0.4s",
    "",
    "#12 [dummy2 4/5] RUN date > file6",
    "#12 DONE 0.5s",
    "",
    "#13 [dummy2 5/5] RUN touch foo",
    "#13 ...",
    "",
    "#14 [dummy3 3/5] RUN date > file2",
    "#14 DONE 0.6s",
    "",
    "#13 [dummy2 5/5] RUN touch foo",
    "#13 DONE 0.6s",
    "",
    "#15 [dummy2] exporting to image",
    "#15 exporting layers",
    "#18 writing image sha256:a6b78b7fa183a2cce1541fd0353741f3f041a4df9c9de95da9d9a94329bf6cc8 done",
    "#18 naming to docker.io/library/dummy done",
    "#18 DONE 0.1s"
  ]
}
@felixfontein
Copy link
Collaborator

This very likely isn't related to #787, but more likely a bug in Docker Compose itself. I don't think it should emit that error if there isn't really an error. But I have to look into more detail and try this out (I only have a few minutes right now).

@mabeett
Copy link
Author

mabeett commented Feb 26, 2024

ok,
I left a playbook with the spirit of replicating the problem.
Let me know if you need more information.

@felixfontein
Copy link
Collaborator

The problem here is that Docker Compose issues warnings and errors due to pulling (apparently). You can also see them nicely with the default output:

[+] Running 3/3
 ! dummy2 Warning                                                                                                                                                                        2.4s 
 ✘ dummy Error                                                                                                                                                                           2.4s 
 ! dummy3 Warning                                                                                                                                                                        2.4s 
[+] Building 1.0s (18/18) FINISHED                                                                                                                                             docker:default
[...]

Unfortunately these error/warning messages are not helpful since they do not contain any details (the syslog offers level=error msg="Not continuing with pull after error: errors:\ndenied: requested access to the resource is denied\nunauthorized: authentication required\n"). The same error happens without the scaling BTW.

I also tracked down the warning/error generation in Docker Compose itself, the messages associated to them are "pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed". I'll create a PR for Compose that will expose these messages. With the PR it looks like this:

 dummy3 Pulling 
 dummy2 Pulling 
 dummy2 Warning: Error response from daemon: pull access denied for dummy2, repository does not exist or may require 'docker login': denied: requested access to the resource is denied 
 dummy Error: Error response from daemon: pull access denied for dummy2, repository does not exist or may require 'docker login': denied: requested access to the resource is denied 
 dummy3 Warning: Error response from daemon: pull access denied for dummy, repository does not exist or may require 'docker login': denied: requested access to the resource is denied 

The nice output version is kind of broken since the messages are longer than a line if you don't have an ultra-wide terminal, though (might be that they chose not to show the full message because of that...).

I guess the docker_compose_v2 module has to treat errors that do not result in a non-zero exit code as non-fatal errors and simply emit warnings. (Which in the current state of Docker Compose are not very helpful, since the message "dummy Error" isn't helpful at all, but 🤷.)

@felixfontein
Copy link
Collaborator

docker/compose#11555 improves the Compose error reporting when pulling, and #810 no longer fails the module on non-fatal errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docker-compose-v2 Docker Compose v2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants