How to set containerfile PKGMGR to microdnf in execution-environment.yml

When building an execution environment with a centos10-minimal base image, how do you configure containerfile PKGMGR to be microdnf instead of dnf?

It looks like context/_build/scripts/assemble will correctly discover and use microdnf, but before (?) then, the containerfile is built with hard coded dnf. Can this be overridden?

$ ansible-builder build -vvv
[...]
Running command:
  podman build -f context/Containerfile -t ansible-execution-env:latest context
[...]
[1/3] STEP 13/14: RUN $PKGMGR install $PYPKG -y ; if [ -z $PKGMGR_PRESERVE_CACHE ]; then $PKGMGR clean all; fi
/bin/sh: line 1: /usr/bin/dnf: No such file or directory
$ cat execution-environment.yml
---
version: 3

images:
  base_image:
    name: quay.io/centos/centos:stream10-minimal

dependencies:
  python_interpreter:
    package_system: "python312"
$ cat context/Containerfile
ARG EE_BASE_IMAGE="quay.io/centos/centos:stream10-minimal"
ARG PYCMD="/usr/bin/python3"
ARG PYPKG="python312"
ARG PKGMGR_PRESERVE_CACHE=""
ARG ANSIBLE_GALAXY_CLI_COLLECTION_OPTS=""
ARG ANSIBLE_GALAXY_CLI_ROLE_OPTS=""
ARG PKGMGR="/usr/bin/dnf"
[...]
$ ansible-builder --version
3.1.0

$ podman --version
podman version 4.3.1

$ 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/"

$ ansible --version
ansible [core 2.18.3]
  config file = [...]/twansible/ansible.cfg
  configured module search path = ['/home/[...]/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/[...]/.local/pipx/venvs/ansible/lib/python3.11/site-packages/ansible
  ansible collection location = /home/[...]/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/[...]/.local/bin/ansible
  python version = 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] (/home/[...]/.local/pipx/venvs/ansible/bin/python)
  jinja version = 3.1.2
  libyaml = True

Also found

# Custom package manager path for the RHEL based images
# options:
#  package_manager_path: /usr/bin/microdnf

in Execution environment definition — Ansible Builder Documentation

That doesn’t seem to be a viable setting though:

$ cat execution-environment.yml
---
version: 3

images:
  base_image:
    name: quay.io/centos/centos:stream10-minimal
  options:
    package_manager_path: /usr/bin/microdnf
[...]
$ ansible-builder build -vvv
jsonschema.exceptions.ValidationError: Additional properties are not allowed ('options' was unexpected)

Failed validating 'additionalProperties' in schema['properties']['images']:
    {'additionalProperties': False,
     'properties': {'base_image': {'properties': {'name': {'type': 'string'},
                                                  'signature_original_name': {'type': 'string'}},
                                   'type': 'object'}},
     'type': 'object'}

On instance['images']:
    {'base_image': {'name': 'quay.io/centos/centos:stream10-minimal'},
     'options': {'package_manager_path': '/usr/bin/microdnf'}}

The above exception was the direct cause of the following exception:

ansible_builder.exceptions.DefinitionError: Additional properties are not allowed ('options' was unexpected)

But wait, there’s this: ansible-builder/src/ansible_builder/ee_schema.py at 5a3fedc79fa93367dd937bf9b83f7a24e43c8708 · ansible/ansible-builder · GitHub - Looks like I misread the example.

$ cat execution-environment.yml                                                                                                                ✘ 1 
---
version: 3

images:
  base_image:
    name: quay.io/centos/centos:stream10-minimal
options:
  package_manager_path: /usr/bin/microdnf
[...]

Success! (so far)

$ ansible-builder build -vvv
[...]
[1/4] STEP 14/16: RUN $PKGMGR install $PYPKG -y ; if [ -z $PKGMGR_PRESERVE_CACHE ]; then $PKGMGR clean all; fi
Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                           Repository     Size
Installing:                                                          
 expat-2.7.1-1.el10.x86_64                        baseos     119.9 kB
 gdbm-libs-1:1.23-11.el10.x86_64                  baseos      58.7 kB
 libxcrypt-4.4.36-10.el10.x86_64                  baseos     122.9 kB
 mpdecimal-2.5.1-12.el10.x86_64                   baseos      92.3 kB
 python-unversioned-command-3.12.11-2.el10.noarch appstream   13.2 kB
 python3-3.12.11-2.el10.x86_64                    baseos      30.4 kB
 python3-libs-3.12.11-2.el10.x86_64               baseos       9.9 MB
 python3-pip-wheel-23.3.2-7.el10.noarch           baseos       1.5 MB
Transaction Summary:
 Installing:        8 packages
 Reinstalling:      0 packages
 Upgrading:         0 packages
 Obsoleting:        0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Downloading packages...
1 Like