Skip to content

Any proper way to use ansible-bender on base images without a Python runtime? #260

@brlin-tw

Description

@brlin-tw

Hello, just trying to test ansible-bender on a official alpine base image on Docker Hub but encountered the following error:

$ ansible-bender build playbooks/build-container.yml 
01:22:35.205 buildah_builder.py ERROR  couldn't locate python interpreter, tried these paths: ('/usr/bin/python3', '/usr/local/bin/python3', '/usr/bin/python3.7', '/usr/bin/python37', '/usr/bin/python3.6', '/usr/bin/python36', '/usr/bin/python2', '/usr/local/bin/python2', '/usr/bin/python', '/usr/local/bin/python', '/usr/libexec/platform-python')
There was an error during execution: no python interpreter was found in the base image "docker.io/alpine:latest", you can specify the path via CLI option --python-interpreter

Then, I tried to install a Python3 runtime beforehand in my playbook but it didn't work:

---
- name: 使用 ansible-bender 建置容器
  hosts: all
  # Alpine doesn't have Python installation by default we collect these
  # later after we have one
  gather_facts: False
  vars:
    ansible_bender:
      base_image: docker.io/alpine:latest
      target_image:
        name: latest-bash
        cmd: ash
  pre_tasks:
    - name: Install Python for Ansible runtime
      raw: apk add python3

  tasks:
    - name: Install GNU Bash
      become: True
      apk:
        name: bash

Is there anyway to do so, without preparing a custom image?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions