# `Tank.Image.User`
[🔗](https://github.com/oshlabs/tank/blob/v0.2.0/lib/tank/image/user.ex#L1)

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.

# `resolve`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
