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
68              $ podman unshare --foo; echo $?
69              Error: unknown flag: --foo
70              125
71
72
73
74       126 Executing a contained command and the command cannot be invoked
75
76
77              $ podman unshare /etc; echo $?
78              Error: fork/exec /etc: permission denied
79              126
80
81
82
83       127 Executing a contained command and the command cannot be found
84
85
86              $ podman unshare foo; echo $?
87              Error: fork/exec /usr/bin/bogus: no such file or directory
88              127
89
90
91
92       Exit code contained command exit code
93
94
95              $ podman unshare /bin/sh -c 'exit 3'; echo $?
96              3
97
98
99

EXAMPLE

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

SEE ALSO

129       podman(1), podman-mount(1), namespaces(7), newuidmap(1),  newgidmap(1),
130       user_namespaces(7)
131
132
133
134                                                             podman-unshare(1)
Impressum