| 1 |
# Rootless execution of stargz snapshotter |
| 2 |
|
| 3 |
This document lists links and information about how to run Stargz Snapshotter and Stargz Store from the non-root user. |
| 4 |
|
| 5 |
## nerdctl (Stargz Snapshotter) |
| 6 |
|
| 7 |
Rootless Stargz Snapshotter for nerdctl can be installed via `containerd-rootless-setuptool.sh install-stargz` command. |
| 8 |
Please see [the doc in nerdctl repo](https://github.com/containerd/nerdctl/blob/v1.1.0/docs/rootless.md#stargz-snapshotter) for details. |
| 9 |
|
| 10 |
## Podman (Stargz Store) |
| 11 |
|
| 12 |
> NOTE: This is an experimental configuration leveraging [`podman unshare`](https://docs.podman.io/en/latest/markdown/podman-unshare.1.html). Limitation: `--uidmap` of `podman run` doesn't work. |
| 13 |
|
| 14 |
First, allow podman using Stargz Store by adding the following store configuration. |
| 15 |
Put the configuration file to [`/etc/containers/storage.conf` or `$HOME/.config/containers/storage.conf`](https://github.com/containers/podman/blob/v4.3.1/docs/tutorials/rootless_tutorial.md#storageconf). |
| 16 |
|
| 17 |
> NOTE: Replace `/path/to/home` to the actual home directory. |
| 18 |
|
| 19 |
``` |
| 20 |
[storage] |
| 21 |
driver = "overlay" |
| 22 |
|
| 23 |
[storage.options] |
| 24 |
additionallayerstores = ["/path/to/homedir/.local/share/stargz-store/store:ref"] |
| 25 |
``` |
| 26 |
|
| 27 |
Start Stargz Store in the namespace managed by podman via [`podman unshare`](https://docs.podman.io/en/latest/markdown/podman-unshare.1.html) command. |
| 28 |
|
| 29 |
``` |
| 30 |
$ podman unshare stargz-store --root $HOME/.local/share/stargz-store/data $HOME/.local/share/stargz-store/store & |
| 31 |
``` |
| 32 |
|
| 33 |
Podman performs lazy pulling when it pulls eStargz images. |
| 34 |
|
| 35 |
``` |
| 36 |
$ podman pull ghcr.io/stargz-containers/python:3.9-esgz |
| 37 |
``` |
| 38 |
|
| 39 |
<details> |
| 40 |
<summary>Creating systemd unit file for Stargz Store</summary> |
| 41 |
|
| 42 |
It's possible to create systemd unit file of Stargz Store for easily managing it. |
| 43 |
An example systemd unit file can be found [here](../script/podman/config/podman-rootless-stargz-store.service) |
| 44 |
|
| 45 |
After installing that file (e.g. to `$HOME/.config/systemd/user/`), start the service using `systemctl`. |
| 46 |
|
| 47 |
``` |
| 48 |
$ systemctl --user start podman-rootless-stargz-store |
| 49 |
``` |
| 50 |
|
| 51 |
</details> |
| 52 |
|
| 53 |
## BuildKit (Stargz Snapshotter) |
| 54 |
|
| 55 |
BuildKit supports running Stargz Snapshotter from the non-root user. |
| 56 |
Please see [the doc in BuildKit repo](https://github.com/moby/buildkit/blob/8b132188aa7af944c813d02da63c93308d83cf75/docs/stargz-estargz.md) (unmerged 2023/1/18) for details. |