Skip to main content

wrap_dockerfile_preserving_user

Function wrap_dockerfile_preserving_user 

Source
pub fn wrap_dockerfile_preserving_user(
    task: &str,
    opts: &WrapOptions,
) -> Result<String, Error>
Expand description

Preserve the final Dockerfile USER as the default identity for workload execs.

This is opt-in: wrap_dockerfile retains its historical root-default behavior. The builder, not the client, resolves final-stage inheritance, USER variables, names and numeric ids. A build-only agentd invocation records its effective uid and primary gid, then the stanza restores root and seals that record. No workload starts before readiness, and the daemon remains the image’s CMD.

An explicit AGENTD_DEFAULT_USER in the image overrides the captured identity, including an empty value (which refuses implicit-user execs). A request’s user overrides either default; its group overrides the default primary gid. The captured ids are fixed at build time; passwd identity variables are still resolved per request. Supplementary groups follow the daemon’s existing policy and are cleared. The builder must support COPY --chmod.