{"record":{"id":"8e336845432c9a61","repo":"jdx/mise","slug":"mise-oci-needs-a-linux-host-to-install-apk-system","errorCode":null,"errorMessage":"mise oci needs a Linux host to install apk system packages into an image","messagePattern":"mise oci needs a Linux host to install apk system packages into an image","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/oci/packages.rs","lineNumber":134,"sourceCode":"        \"oci: adding {} system packages: {}\",\n        manager.name(),\n        requests\n            .iter()\n            .map(ToString::to_string)\n            .collect::<Vec<_>>()\n            .join(\", \")\n    );\n    Ok(Some(SystemPackagesLayer {\n        blob: layer::build_layer_from_dir_preserve_metadata(&diff_dir, \"\")?,\n        manager: manager.name(),\n    }))\n}\n\nfn validate_host_requirements(manager: OciPackageManager) -> Result<()> {\n    match manager {\n        OciPackageManager::Apk => {\n            if std::env::consts::OS != \"linux\" {\n                bail!(\"mise oci needs a Linux host to install apk system packages into an image\");\n            }\n            if file::which(\"apk\").is_none() {\n                bail!(\"mise oci needs `apk` on PATH to install apk system packages into the image\");\n            }\n            if !crate::system::sudo::is_root() {\n                bail!(\n                    \"mise oci needs to run as root to install apk system packages because apk \\\n                     executes package scripts in a chroot\"\n                );\n            }\n        }\n        OciPackageManager::Apt => {\n            if file::which(\"apt-get\").is_none() {\n                bail!(\n                    \"mise oci needs `apt-get` on PATH to install apt system packages into the image\"\n                );\n            }\n            if file::which(\"dpkg\").is_none() {","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/oci/packages.rs#L116-L152","documentation":"For apk packages, mise runs the host's apk binary in a chroot against the unpacked image rootfs — there is no container engine. apk only exists/runs meaningfully on Linux, so building an apk-packages image from macOS or Windows is rejected up front by validate_host_requirements.","triggerScenarios":"mise oci build on macOS or Windows with [bootstrap.packages] containing apk entries (or an alpine base whose packages resolve to apk).","commonSituations":"Developing on a Mac and building images locally instead of in CI; the docs/quickstart alpine example run from a non-Linux workstation.","solutions":["Run the build on a Linux host or CI runner (GitHub Actions ubuntu-latest, a linux container with docker).","On macOS, delegate to a remote builder or cross-build inside a devcontainer with docker.","Or remove the apk entries so the packages layer is skipped."],"exampleFix":"# before (on macOS)\nmise oci build\n\n# after (inside linux CI or devcontainer)\nmise oci build","handlingStrategy":"validation","validationCode":"import platform, sys\nuses_apk = any_apk_entries(config)\nif uses_apk and platform.system() != \"Linux\":\n    sys.exit(\"apk packages require a Linux build host; run in CI or a linux container\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Move image builds to Linux CI; keep macOS workstations for dev only.","In a devcontainer/Docker Desktop setup, run mise oci build inside the linux VM/container.","Document the host requirement next to [bootstrap.packages] in the repo's mise docs."],"tags":["oci","packages","apk","platform","macos"],"backgroundTag":"platform-not-supported","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}