1buildah-unshare(1) General Commands Manual buildah-unshare(1)
2
3
4
6 buildah-unshare - Run a command inside of a modified user namespace.
7
8
10 buildah unshare [options] [--] [command]
11
12
14 Launches a process (by default, $SHELL) in a new user namespace. The
15 user namespace is configured so that the invoking user's UID and pri‐
16 mary GID appear to be UID 0 and GID 0, respectively. Any ranges which
17 match that user and group in /etc/subuid and /etc/subgid are also
18 mapped in as themselves with the help of the newuidmap(1) and
19 newgidmap(1) helpers.
20
21
22 buildah unshare is useful for troubleshooting unprivileged operations
23 and for manually clearing storage and other data related to images and
24 containers.
25
26
27 It is also useful if you want to use the buildah mount command. If an
28 unprivileged users wants to mount and work with a container, then they
29 need to execute buildah unshare. Executing buildah mount fails for
30 unprivileged users unless the user is running inside a buildah unshare
31 session.
32
33
35 buildah unshare id
36
37
38 buildah unshare pwd
39
40
41 buildah unshare cat /proc/self/uid_map /proc/self/gid_map
42
43
44 buildah unshare rm -fr $HOME/.local/share/containers/storage
45 /var/run/user/`id -u`/run
46
47
48 If you want to use buildah with a mount command then you can create a
49 script that looks something like:
50
51
52 cat buildah-script.sh << _EOF
53 ctr=$(buildah from scratch)
54 mnt=$(buildah mount $ctr)
55 dnf -y install --installroot=$mnt PACKAGES
56 dnf -y clean all --installroot=$mnt
57 buildah config --entrypoint="/bin/PACKAGE" --env "FOO=BAR" $ctr
58 buildah commit $ctr IMAGENAME
59 buildah unmount $ctr
60 _EOF
61
62
63
64 Then execute it with:
65
66
67 buildah unshare buildah-script.sh
68
69
70
72 buildah(1), buildah-mount(1), namespaces(7), newuidmap(1),
73 newgidmap(1), user_namespaces(7)
74
75
76
77buildah June 2018 buildah-unshare(1)