Skip to content

nihil build fails on ARM64 hosts: docker build is missing --platform #6

Description

@0xbbuddha

Problem

nihil build fails on ARM64 hosts (Apple Silicon, ARM Linux).

_cmd_build shells out to docker build with no --platform flag (nihil/cli/controller.py:1217), and all our Dockerfiles are based on FROM archlinux:latest, which upstream publishes for linux/amd64 only. On an ARM64 host the build aborts while resolving the base image, with the same error #5 fixed for pulls:

no matching manifest for linux/arm64/v8 in the manifest list entries

This is the third code path needing an explicit platform hint. #5 covered the other two (image pull and container creation) but deliberately scoped build out.

Suggested fix

Reuse get_image_platform(), added in #5, in _cmd_build when assembling the docker build argv:

image_platform = get_image_platform()
if image_platform:
    cmd += ["--platform", image_platform]

Note that the same import-cycle constraint applies as in manager.py: import get_image_platform inside the function, not at module scope, otherwise nihil.utils -> doctor -> nihil.manager becomes circular.

Acceptance

  • nihil build <variant> completes on an ARM64 host with emulation available (Rosetta or QEMU).
  • Behaviour on amd64 hosts is unchanged, no --platform passed.
  • Unit test asserting the flag is present on ARM and absent on amd64, mirroring the existing tests in tests/test_nihilManager.py.

Notes

Worth checking whether nihil build --tag and the blueteam / test variants need anything beyond this.

@whiteov3rflow this follows on from your #5 and you already have the ARM setup to verify it, so it's yours if you want it. No obligation either way.

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