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_image build args failing #455

Closed
pgstef opened this issue Aug 16, 2022 · 5 comments · Fixed by #456
Closed

docker_image build args failing #455

pgstef opened this issue Aug 16, 2022 · 5 comments · Fixed by #456
Labels
bug Something isn't working docker-plain plain Docker (no swarm, no compose, no stack)

Comments

@pgstef
Copy link

pgstef commented Aug 16, 2022

SUMMARY

Hello,

The docker_image build args doesn't seem to work.

With this simple playbook:

---
- name: Test
  hosts: localhost
  any_errors_fatal: true
  tasks:
    - docker_image:
        name: test
        state: present
        source: build
        build:
          path: .
          dockerfile: "Dockerfile"
          pull: no
          args:
            test: centos:7

And a very small Dockerfile:

ARG test
FROM $test
RUN echo $test

I get the following error message: Error building test - code: None, message: base name ($test) should not be blank, logs: ['Step 1/3 : ARG test', '', 'Step 2/3 : FROM $test', ''].

I'm on python 3.8.10, ansible core 2.13.3 and community.docker 3.0.1.

Many thanks in advance for your help or guidance.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • docker_image
ANSIBLE VERSION
ansible [core 2.13.3]
  config file = None
  configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vagrant/.local/pipx/venvs/ansible-core/lib/python3.8/site-packages/ansible
  ansible collection location = /home/vagrant/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/vagrant/.local/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
Collection        Version
----------------- -------
community.general 2.5.8
community.docker 3.0.1
OS / ENVIRONMENT

I discovered this issue on Ubuntu 20.04 (on a vagrant box: https://app.vagrantup.com/bento/boxes/ubuntu-20.04).

STEPS TO REPRODUCE

See summary for the reproducible test case.

@felixfontein
Copy link
Collaborator

Do you know whether this worked with an older version of community.docker (i.e. 2.x.y or 1.x.y)?

@felixfontein felixfontein added bug Something isn't working docker-plain plain Docker (no swarm, no compose, no stack) labels Aug 16, 2022
@pgstef
Copy link
Author

pgstef commented Aug 16, 2022

Hm, I used it very often previously. I just checked my last gh action logs (https://github.com/pgstef/check_pgbackrest/actions) and it appeared to work with community.docker:2.7.0 21 days ago at least.

Hope this help.
Thanks again for your help

@n-at
Copy link

n-at commented Aug 16, 2022

I had the same issue today, downgrade community.docker to 2.7.1 resolved that for me.

@felixfontein
Copy link
Collaborator

Thanks for the feedback, I've started working on this (by adding a test for this). This is very likely related to the change that docker_image no longer needs the Docker SDK for Python.

@felixfontein
Copy link
Collaborator

Ok, this was a stupid bug: 49fa69e

#456 fixes the bug, once it is reviewed and merged I will create a new bugfix release.

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-plain plain Docker (no swarm, no compose, no stack)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants