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

**URL:** <https://forum.ansible.com/t/how-to-set-containerfile-pkgmgr-to-microdnf-in-execution-environment-yml/43909>\
**Category:** Get Help\
**Tags:** ansible-builder, ee\
**Created:** [July 16, 2025, 4:40pm UTC](https://forum.ansible.com/t/how-to-set-containerfile-pkgmgr-to-microdnf-in-execution-environment-yml/43909 "2025-07-16T16:40:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cruscio](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cruscio/32/435_2.png) [@cruscio](https://forum.ansible.com/u/cruscio)\
**Post date:** [July 16, 2025, 4:40pm UTC](https://forum.ansible.com/t/how-to-set-containerfile-pkgmgr-to-microdnf-in-execution-environment-yml/43909/1 "2025-07-16T16:40:35Z")

</div>

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?

```auto
$ 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

```

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

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

dependencies:
  python_interpreter:
    package_system: "python312"

```

```auto
$ 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"
[...]

```

```auto
$ 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

```

---

<div class="post-metadata">

**Author:** ![cruscio](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cruscio/32/435_2.png) [@cruscio](https://forum.ansible.com/u/cruscio)\
**Post date:** [July 16, 2025, 5:19pm UTC](https://forum.ansible.com/t/how-to-set-containerfile-pkgmgr-to-microdnf-in-execution-environment-yml/43909/2 "2025-07-16T17:19:59Z")

</div>

Also found

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

```

in [Execution environment definition — Ansible Builder Documentation](https://ansible.readthedocs.io/projects/builder/en/stable/definition/#version-3-sample-file)

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

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

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

```

```auto
$ 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)

```

---

<div class="post-metadata">

**Author:** ![cruscio](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cruscio/32/435_2.png) [@cruscio](https://forum.ansible.com/u/cruscio)\
**Post date:** [July 16, 2025, 5:25pm UTC](https://forum.ansible.com/t/how-to-set-containerfile-pkgmgr-to-microdnf-in-execution-environment-yml/43909/3 "2025-07-16T17:25:12Z")

</div>

But wait, there’s this: [ansible-builder/src/ansible\_builder/ee\_schema.py at 5a3fedc79fa93367dd937bf9b83f7a24e43c8708 · ansible/ansible-builder · GitHub](https://github.com/ansible/ansible-builder/blob/5a3fedc79fa93367dd937bf9b83f7a24e43c8708/src/ansible_builder/ee_schema.py#L379) - Looks like I misread the example.

```auto
$ 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)

```auto
$ 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...

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [August 15, 2025, 5:25pm UTC](https://forum.ansible.com/t/how-to-set-containerfile-pkgmgr-to-microdnf-in-execution-environment-yml/43909/4 "2025-08-15T17:25:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
