.nh .TH buildah\-unshare "1" "June 2018" "buildah" .SH NAME .PP buildah\-unshare \- Run a command inside of a modified user namespace. .SH SYNOPSIS .PP \fBbuildah unshare\fP [\fIoptions\fP] [\fB\-\-\fP] [\fIcommand\fP] .SH DESCRIPTION .PP Launches a process (by default, \fI$SHELL\fP) in a new user namespace. The user namespace is configured so that the invoking user's UID and primary GID appear to be UID 0 and GID 0, respectively. Any ranges which match that user and group in /etc/subuid and /etc/subgid are also mapped in as themselves with the help of the \fInewuidmap(1)\fP and \fInewgidmap(1)\fP helpers. .PP buildah unshare is useful for troubleshooting unprivileged operations and for manually clearing storage and other data related to images and containers. .PP It is also useful if you want to use the \fB\fCbuildah mount\fR command. If an unprivileged users wants to mount and work with a container, then they need to execute buildah unshare. Executing \fB\fCbuildah mount\fR fails for unprivileged users unless the user is running inside a \fB\fCbuildah unshare\fR session. .SH OPTIONS .PP \fB\-\-mount\fP [\fIVARIABLE=]containerNameOrID\fP .PP Mount the \fIcontainerNameOrID\fP container while running \fIcommand\fP, and set the environment variable \fIVARIABLE\fP to the path of the mountpoint. If \fIVARIABLE\fP is not specified, it defaults to \fIcontainerNameOrID\fP, which may not be a valid name for an environment variable. .SH EXAMPLE .PP buildah unshare id .PP buildah unshare pwd .PP buildah unshare cat /proc/self/uid\_map /proc/self/gid\_map .PP buildah unshare rm \-fr $HOME/.local/share/containers/storage /run/user/`id \-u`/run .PP buildah unshare \-\-mount containerID sh \-c 'cat ${containerID}/etc/os\-release' .PP If you want to use buildah with a mount command then you can create a script that looks something like: .PP .RS .nf cat buildah\-script.sh << \_EOF #!/bin/sh ctr=$(buildah from scratch) mnt=$(buildah mount $ctr) dnf \-y install \-\-installroot=$mnt PACKAGES dnf \-y clean all \-\-installroot=$mnt buildah config \-\-entrypoint="/bin/PACKAGE" \-\-env "FOO=BAR" $ctr buildah commit $ctr imagename buildah unmount $ctr \_EOF .fi .RE .PP Then execute it with: .PP .RS .nf buildah unshare buildah\-script.sh .fi .RE .SH SEE ALSO .PP buildah(1), buildah\-mount(1), namespaces(7), newuidmap(1), newgidmap(1), user\_namespaces(7)