1buildah-unshare(1)          General Commands Manual         buildah-unshare(1)
2
3
4

NAME

6       buildah-unshare - Run a command inside of a modified user namespace.
7
8

SYNOPSIS

10       buildah unshare [options] [--] [command]
11
12

DESCRIPTION

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

OPTIONS

35       --mount [VARIABLE=]containerNameOrID
36
37
38       Mount the containerNameOrID container while running  command,  and  set
39       the  environment  variable  VARIABLE to the path of the mountpoint.  If
40       VARIABLE is not specified, it defaults to containerNameOrID, which  may
41       not be a valid name for an environment variable.
42
43

EXAMPLE

45       buildah unshare id
46
47
48       buildah unshare pwd
49
50
51       buildah unshare cat /proc/self/uid_map /proc/self/gid_map
52
53
54       buildah    unshare    rm    -fr   $HOME/.local/share/containers/storage
55       /var/run/user/`id -u`/run
56
57
58       buildah   unshare   --mount   containerID    sh    -c    'cat    ${con‐
59       tainerID}/etc/os-release'
60
61
62       If  you  want to use buildah with a mount command then you can create a
63       script that looks something like:
64
65
66              cat buildah-script.sh << _EOF
67              ctr=$(buildah from scratch)
68              mnt=$(buildah mount $ctr)
69              dnf -y install --installroot=$mnt PACKAGES
70              dnf -y clean all --installroot=$mnt
71              buildah config --entrypoint="/bin/PACKAGE" --env "FOO=BAR" $ctr
72              buildah commit $ctr IMAGENAME
73              buildah unmount $ctr
74              _EOF
75
76
77
78       Then execute it with:
79
80
81              buildah unshare buildah-script.sh
82
83
84

SEE ALSO

86       buildah(1),     buildah-mount(1),     namespaces(7),      newuidmap(1),
87       newgidmap(1), user_namespaces(7)
88
89
90
91buildah                            June 2018                buildah-unshare(1)
Impressum