table of contents
BWRAP(1) | User Commands | BWRAP(1) |
NAME¶
bwrap - container setup utility
SYNOPSIS¶
bwrap [OPTION...] [COMMAND]
DESCRIPTION¶
bwrap is a privileged helper for container setup. You are unlikely to use it directly from the commandline, although that is possible.
It works by creating a new, completely empty, filesystem namespace where the root is on a tmpfs that is invisible from the host, and which will be automatically cleaned up when the last process exits. You can then use commandline options to construct the root filesystem and process environment for the command to run in the namespace.
By default, bwrap creates a new mount namespace for the sandbox. Optionally it also sets up new user, ipc, pid, network and uts namespaces (but note the user namespace is required if bwrap is not installed setuid root). The application in the sandbox can be made to run with a different UID and GID.
If needed (e.g. when using a PID namespace) bwrap is running a minimal pid 1 process in the sandbox that is responsible for reaping zombies. It also detects when the initial application process (pid 2) dies and reports its exit status back to the original spawner. The pid 1 process exits to clean up the sandbox when there are no other processes in the sandbox left.
OPTIONS¶
When options are used multiple times, the last option wins, unless otherwise specified.
General options:
--help
--version
--args FD
Options related to kernel namespaces:
--unshare-user
--unshare-user-try
--unshare-ipc
--unshare-pid
--unshare-net
--unshare-uts
--unshare-cgroup
--unshare-cgroup-try
--unshare-all
--userns FD
This is incompatible with --unshare-user, and doesn't work in the setuid version of bubblewrap.
--userns2 FD
This is useful because sometimes bubblewrap itself creates nested user namespaces (to work around some kernel issues) and --userns2 can be used to enter these.
--pidns FD
Note that this can be combined with --unshare-pid, and in that case it means that the sandbox will be in its own pid namespace, which is a child of the passed in one.
--uid UID
--gid GID
--hostname HOSTNAME
Options about environment setup:
--chdir DIR
--setenv VAR VALUE
--unsetenv VAR
Options for monitoring the sandbox from the outside:
--lock-file DEST
--sync-fd FD
Filesystem related options. These are all operations that modify the filesystem directly, or mounts stuff in the filesystem. These are applied in the order they are given as arguments. Any missing parent directories that are required to create a specified destination are automatically created as needed.
--bind SRC DEST
--bind-try SRC DEST
--dev-bind SRC DEST
--dev-bind-try SRC DEST
--ro-bind SRC DEST
--ro-bind-try SRC DEST
--remount-ro DEST
--proc DEST
--dev DEST
--tmpfs DEST
--mqueue DEST
--dir DEST
--file FD DEST
--bind-data FD DEST
--ro-bind-data FD DEST
--symlink SRC DEST
Lockdown options:
--seccomp FD
--exec-label LABEL
--file-label LABEL
--block-fd FD
--userns-block-fd FD
--info-fd FD
--new-session
Note: In a general sandbox, if you don't use --new-session, it is recommended to use seccomp to disallow the TIOCSTI ioctl, otherwise the application can feed keyboard input to the terminal.
--die-with-parent
--as-pid-1
--cap-add CAP
--cap-drop CAP
ENVIRONMENT¶
HOME
EXIT STATUS¶
The bwrap command returns the exit status of the initial application process (pid 2 in the sandbox).
Project Atomic |