Tank.Image.User (Tank v0.1.0)

Copy Markdown View Source

Resolves an image's User spec to a numeric {uid, gid}.

A User spec -- the image config User field, or a container's :user override -- is user[:group], where each part is a name or a number. Names are looked up in the rootfs's own /etc/passwd and /etc/group, the same files the container sees, so resolution matches what runs inside.

Summary

Functions

Resolves spec against rootfs's /etc/passwd and /etc/group.

Functions

resolve(rootfs, spec)

@spec resolve(Path.t(), String.t() | nil) ::
  {:ok, {non_neg_integer(), non_neg_integer()}}
  | {:error, {:unknown_user | :unknown_group, String.t()}}

Resolves spec against rootfs's /etc/passwd and /etc/group.

Returns {:ok, {uid, gid}}; an empty / nil / "root" spec is {0, 0}. A numeric uid with no matching /etc/passwd entry takes gid 0, as Docker does. Returns {:error, {:unknown_user | :unknown_group, name}} for a name absent from the database.