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

NAME

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

SYNOPSIS

10       podman 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       podman 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 to use the podman mount command.  If an  unprivileged
28       user  wants  to mount and work with a container, then they need to exe‐
29       cute podman unshare.  Executing podman  mount  fails  for  unprivileged
30       users unless the user is running inside a podman unshare session.
31
32
33       The unshare session defines two environment variables:
34
35
36CONTAINERS_GRAPHROOT:  the  path to the persistent container's
37                data.
38
39CONTAINERS_RUNROOT: the path to the volatile container's data.
40
41
42
43       IMPORTANT: This command is not available with the remote Podman client.
44
45

OPTIONS

47   --help, -h
48       Print usage statement
49
50
51   --rootless-netns
52       Join the rootless network namespace used for  netavark  networking.  It
53       can  be  used to connect to a rootless container via IP address (bridge
54       networking). This is otherwise not possible from the host network name‐
55       space.
56
57

Exit Codes

59       The  exit code from podman unshare gives information about why the con‐
60       tainer failed to run or why it exited.  When  podman  unshare  commands
61       exit  with  a non-zero code, the exit codes follow the chroot standard,
62       see below:
63
64
65       125 The error is with podman itself
66
67       $ podman unshare --foo; echo $?
68       Error: unknown flag: --foo
69       125
70
71
72
73       126 Executing a contained command and the command cannot be invoked
74
75       $ podman unshare /etc; echo $?
76       Error: fork/exec /etc: permission denied
77       126
78
79
80
81       127 Executing a contained command and the command cannot be found
82
83       $ podman unshare foo; echo $?
84       Error: fork/exec /usr/bin/bogus: no such file or directory
85       127
86
87
88
89       Exit code contained command exit code
90
91       $ podman unshare /bin/sh -c 'exit 3'; echo $?
92       3
93
94
95

EXAMPLE

97       $ podman unshare id
98       uid=0(root) gid=0(root) groups=0(root),65534(nobody)
99
100       $ podman unshare cat /proc/self/uid_map /proc/self/gid_map
101                0       1000          1
102                1      10000      65536
103                0       1000          1
104                1      10000      65536
105
106       $ podman unshare --rootless-netns ip addr
107       1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
108           link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
109           inet 127.0.0.1/8 scope host lo
110              valid_lft forever preferred_lft forever
111           inet6 ::1/128 scope host
112              valid_lft forever preferred_lft forever
113       2: tap0: <BROADCAST,UP,LOWER_UP> mtu 65520 qdisc fq_codel state UNKNOWN group default qlen 1000
114           link/ether aa:8c:0b:73:98:f6 brd ff:ff:ff:ff:ff:ff
115           inet 10.0.2.100/24 brd 10.0.2.255 scope global tap0
116              valid_lft forever preferred_lft forever
117           inet6 fd00::a88c:bff:fe73:98f6/64 scope global dynamic mngtmpaddr
118              valid_lft 86389sec preferred_lft 14389sec
119           inet6 fe80::a88c:bff:fe73:98f6/64 scope link
120              valid_lft forever preferred_lft forever
121
122
123

SEE ALSO

125       podman(1), podman-mount(1), namespaces(7), newuidmap(1),  newgidmap(1),
126       user_namespaces(7)
127
128
129
130                                                             podman-unshare(1)
Impressum