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

compose_v2: Unknown resource type 'Service' with build: always #1015

Open
ZauberNerd opened this issue Dec 19, 2024 · 1 comment
Open

compose_v2: Unknown resource type 'Service' with build: always #1015

ZauberNerd opened this issue Dec 19, 2024 · 1 comment
Labels
docker-compose-v2 Docker Compose v2 question Further information is requested

Comments

@ZauberNerd
Copy link

SUMMARY

Trying to build images with docker compose results in a warning being printed:

[WARNING]: Unknown resource type 'Service' in line b'{"id":"Service test-service","status":"Building"}'.
ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.docker.docker_compose_v2

ANSIBLE VERSION
ansible [core 2.17.5]
  config file = None
  configured module search path = ['/home/vscode/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/pipx/venvs/ansible/lib/python3.11/site-packages/ansible
  ansible collection location = /home/vscode/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] (/opt/pipx/venvs/ansible/bin/python)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
# /opt/pipx/venvs/ansible/lib/python3.11/site-packages/ansible_collections
Collection       Version
---------------- -------
community.docker 3.12.1
CONFIGURATION
CONFIG_FILE() = None
OS / ENVIRONMENT

Running in a devcontainer on Ubuntu.
Host:

PRETTY_NAME="Ubuntu 24.04 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

devcontainer:

vscode ➜ /workspaces/fsi/packer/stream (main) $ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
vscode ➜ /workspaces/fsi/packer/stream (main) $ uname -a
Linux 216e44a9479e 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul  5 10:34:03 UTC 2024 x86_64 GNU/Linux
STEPS TO REPRODUCE

task:

- name: Ensure all images are present and built
  community.docker.docker_compose_v2:
    project_src: /somewhere
    state: stopped
    build: always
    pull: missing

docker-compose.yaml:

services:
  test-service:
    image: test-service:latest
    pull_policy: never
    build:
      dockerfile: Dockerfile
  other-service:
    image: python:latest

Dockerfile:

FROM ubuntu:latest

RUN apt-get update -qq

Output of docker compose --ansi never --progress json up --detach --no-color --quiet-pull --build --pull always --no-start:

{"id":"other-service","text":"Pulling"}
{"id":"other-service","text":"Pulled"}
{"id":"Service test-service","status":"Building"}
{"vertexes":[{"digest":"sha256:af331986e6cd244bb040c859200a67b4167af207ba2189db4267a02233aa8acd","name":"[test-service internal] load build definition from Dockerfile"}]}
{"vertexes":[{"digest":"sha256:af331986e6cd244bb040c859200a67b4167af207ba2189db4267a02233aa8acd","name":"[test-service internal] load build definition from Dockerfile","started":"2024-12-19T10:35:26.115878923Z","completed":"2024-12-19T10:35:26.115903556Z"},{"digest":"sha256:af331986e6cd244bb040c859200a67b4167af207ba2189db4267a02233aa8acd","name":"[test-service internal] load build definition from Dockerfile","started":"2024-12-19T10:35:26.115955993Z"}]}
{"statuses":[{"id":"transferring dockerfile:","vertex":"sha256:af331986e6cd244bb040c859200a67b4167af207ba2189db4267a02233aa8acd","name":"transferring","current":0,"timestamp":"2024-12-19T10:35:26.116562818Z","started":"2024-12-19T10:35:26.116562524Z"}]}
{"statuses":[{"id":"transferring dockerfile:","vertex":"sha256:af331986e6cd244bb040c859200a67b4167af207ba2189db4267a02233aa8acd","name":"transferring","current":29,"timestamp":"2024-12-19T10:35:26.117382582Z","started":"2024-12-19T10:35:26.116562524Z"}]}
{"statuses":[{"id":"transferring dockerfile:","vertex":"sha256:af331986e6cd244bb040c859200a67b4167af207ba2189db4267a02233aa8acd","name":"transferring","current":80,"timestamp":"2024-12-19T10:35:26.118178383Z","started":"2024-12-19T10:35:26.116562524Z","completed":"2024-12-19T10:35:26.118178167Z"}]}
{"vertexes":[{"digest":"sha256:af331986e6cd244bb040c859200a67b4167af207ba2189db4267a02233aa8acd","name":"[test-service internal] load build definition from Dockerfile","started":"2024-12-19T10:35:26.115955993Z","completed":"2024-12-19T10:35:26.119366285Z"}]}
{"vertexes":[{"digest":"sha256:0ea2d3a5bc7b93ef916ceeff90f587f343b4d52df26c632a199e326f7a620686","name":"[test-service internal] load metadata for docker.io/library/ubuntu:latest","started":"2024-12-19T10:35:26.122035175Z"}]}
{"vertexes":[{"digest":"sha256:0ea2d3a5bc7b93ef916ceeff90f587f343b4d52df26c632a199e326f7a620686","name":"[test-service internal] load metadata for docker.io/library/ubuntu:latest","started":"2024-12-19T10:35:26.122035175Z","completed":"2024-12-19T10:35:26.808286391Z"}]}
{"vertexes":[{"digest":"sha256:45eace491d0d43f96f06301d3c546bf675eb32e33df44216d192818dc3b5b08b","name":"[test-service internal] load .dockerignore"}]}
{"vertexes":[{"digest":"sha256:45eace491d0d43f96f06301d3c546bf675eb32e33df44216d192818dc3b5b08b","name":"[test-service internal] load .dockerignore","started":"2024-12-19T10:35:26.809042811Z","completed":"2024-12-19T10:35:26.809097801Z"},{"digest":"sha256:45eace491d0d43f96f06301d3c546bf675eb32e33df44216d192818dc3b5b08b","name":"[test-service internal] load .dockerignore","started":"2024-12-19T10:35:26.809346508Z"}]}
{"statuses":[{"id":"transferring context:","vertex":"sha256:45eace491d0d43f96f06301d3c546bf675eb32e33df44216d192818dc3b5b08b","name":"transferring","current":0,"timestamp":"2024-12-19T10:35:26.811168681Z","started":"2024-12-19T10:35:26.811167809Z"}]}
{"statuses":[{"id":"transferring context:","vertex":"sha256:45eace491d0d43f96f06301d3c546bf675eb32e33df44216d192818dc3b5b08b","name":"transferring","current":0,"timestamp":"2024-12-19T10:35:26.812739829Z","started":"2024-12-19T10:35:26.811167809Z"}]}
{"statuses":[{"id":"transferring context:","vertex":"sha256:45eace491d0d43f96f06301d3c546bf675eb32e33df44216d192818dc3b5b08b","name":"transferring","current":2,"timestamp":"2024-12-19T10:35:26.813700828Z","started":"2024-12-19T10:35:26.811167809Z","completed":"2024-12-19T10:35:26.813700211Z"}]}
{"vertexes":[{"digest":"sha256:45eace491d0d43f96f06301d3c546bf675eb32e33df44216d192818dc3b5b08b","name":"[test-service internal] load .dockerignore","started":"2024-12-19T10:35:26.809346508Z","completed":"2024-12-19T10:35:26.816738729Z"}]}
{"vertexes":[{"digest":"sha256:93e64a149b2c56d41e85e4dc7332360214fbc008675f5a746a97faccd0cc5953","inputs":["sha256:f79430f8c398ec6dec790661888bfeafcc8b314c78fd4e5b304c284679b257e2"],"name":"[test-service 2/2] RUN apt-get update -qq"},{"digest":"sha256:f79430f8c398ec6dec790661888bfeafcc8b314c78fd4e5b304c284679b257e2","name":"[test-service 1/2] FROM docker.io/library/ubuntu:latest@sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab"}]}
{"vertexes":[{"digest":"sha256:f79430f8c398ec6dec790661888bfeafcc8b314c78fd4e5b304c284679b257e2","name":"[test-service 1/2] FROM docker.io/library/ubuntu:latest@sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab","started":"2024-12-19T10:35:26.824336929Z"}]}
{"vertexes":[{"digest":"sha256:f79430f8c398ec6dec790661888bfeafcc8b314c78fd4e5b304c284679b257e2","name":"[test-service 1/2] FROM docker.io/library/ubuntu:latest@sha256:80dd3c3b9c6cecb9f1667e9290b3bc61b78c2678c02cbdae5f0fea92cc6734ab","started":"2024-12-19T10:35:26.824336929Z","completed":"2024-12-19T10:35:26.824544068Z"}]}
{"vertexes":[{"digest":"sha256:93e64a149b2c56d41e85e4dc7332360214fbc008675f5a746a97faccd0cc5953","inputs":["sha256:f79430f8c398ec6dec790661888bfeafcc8b314c78fd4e5b304c284679b257e2"],"name":"[test-service 2/2] RUN apt-get update -qq","started":"2024-12-19T10:35:26.824840778Z","completed":"2024-12-19T10:35:26.824864477Z","cached":true}]}
{"vertexes":[{"digest":"sha256:1d41d9516d510102fd37217eea6d23bff70129a12419290309ee7c1ca9237ab7","name":"[test-service] exporting to image","started":"2024-12-19T10:35:26.826085475Z"}],"statuses":[{"id":"exporting layers","vertex":"sha256:1d41d9516d510102fd37217eea6d23bff70129a12419290309ee7c1ca9237ab7","current":0,"timestamp":"2024-12-19T10:35:26.826121604Z","started":"2024-12-19T10:35:26.826112882Z","completed":"2024-12-19T10:35:26.826121481Z"},{"id":"writing image sha256:e99ac0da486301a092234dc7c9e95e7dbe3e343b945d7d8181482a3cdfaf34bc","vertex":"sha256:1d41d9516d510102fd37217eea6d23bff70129a12419290309ee7c1ca9237ab7","current":0,"timestamp":"2024-12-19T10:35:26.826224607Z","started":"2024-12-19T10:35:26.826224283Z"}]}
{"statuses":[{"id":"writing image sha256:e99ac0da486301a092234dc7c9e95e7dbe3e343b945d7d8181482a3cdfaf34bc","vertex":"sha256:1d41d9516d510102fd37217eea6d23bff70129a12419290309ee7c1ca9237ab7","current":0,"timestamp":"2024-12-19T10:35:26.827404749Z","started":"2024-12-19T10:35:26.826224283Z","completed":"2024-12-19T10:35:26.82740411Z"},{"id":"naming to docker.io/library/test-service:latest","vertex":"sha256:1d41d9516d510102fd37217eea6d23bff70129a12419290309ee7c1ca9237ab7","current":0,"timestamp":"2024-12-19T10:35:26.827429094Z","started":"2024-12-19T10:35:26.82742888Z"}]}
{"statuses":[{"id":"naming to docker.io/library/test-service:latest","vertex":"sha256:1d41d9516d510102fd37217eea6d23bff70129a12419290309ee7c1ca9237ab7","current":0,"timestamp":"2024-12-19T10:35:26.828653985Z","started":"2024-12-19T10:35:26.82742888Z","completed":"2024-12-19T10:35:26.82865342Z"}]}
{"vertexes":[{"digest":"sha256:1d41d9516d510102fd37217eea6d23bff70129a12419290309ee7c1ca9237ab7","name":"[test-service] exporting to image","started":"2024-12-19T10:35:26.826085475Z","completed":"2024-12-19T10:35:26.829397256Z"}]}
{"vertexes":[{"digest":"sha256:4924ce96dea7b589f27411a4f9223fa2a6119e7cb7c5fb907ace98a8a71bc64d","name":"[test-service] resolving provenance for metadata file","started":"2024-12-19T11:35:26.843803147+01:00"}]}
{"id":"Service test-service","status":"Built"}
{"vertexes":[{"digest":"sha256:4924ce96dea7b589f27411a4f9223fa2a6119e7cb7c5fb907ace98a8a71bc64d","name":"[test-service] resolving provenance for metadata file","started":"2024-12-19T11:35:26.843803147+01:00","completed":"2024-12-19T11:35:26.848973331+01:00"}]}
{"id":"Container docker-compose-other-service-1","status":"Recreate"}
{"id":"Container docker-compose-test-service-1","status":"Created"}
{"id":"Container docker-compose-other-service-1","status":"Recreated"}
EXPECTED RESULTS

With state: stopped, build: always, pull: missing I would expect that the containers are built and images are pulled.

ACTUAL RESULTS

It worked, but the module produced a warning, because it can't parse one of the progress lines.

This seems to be a similar issue as #975, which got fixed by #976


@felixfontein
Copy link
Collaborator

Hi, you're using an old version (3.12.1) of community.docker. Please upgrade to the latest 3.x.y version (3.13.4), or to the latest version (4.2.0), and check again.

@felixfontein felixfontein added question Further information is requested docker-compose-v2 Docker Compose v2 labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker-compose-v2 Docker Compose v2 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants