mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
docs: remove prompt symbols from shell snippets
Remove prompt symbols (`$`, `%`) for ease of copy-pasting Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
+11
-11
@@ -34,18 +34,18 @@ The recommended systemd version is 244 or later. Older systemd does not support
|
||||
|
||||
Make sure you also have the `dbus-user-session` (Debian/Ubuntu) or `dbus-daemon` (CentOS/Fedora) package installed, and that `dbus` is running. On Debian-flavored distros, this can be accomplished like so:
|
||||
|
||||
```console
|
||||
$ sudo apt install -y dbus-user-session
|
||||
$ systemctl --user start dbus
|
||||
```bash
|
||||
sudo apt install -y dbus-user-session
|
||||
systemctl --user start dbus
|
||||
```
|
||||
|
||||
## Rootless
|
||||
On cgroup v2 hosts, rootless runc can talk to systemd to get cgroup permissions to be delegated.
|
||||
|
||||
```console
|
||||
$ runc spec --rootless
|
||||
$ jq '.linux.cgroupsPath="user.slice:runc:foo"' config.json | sponge config.json
|
||||
$ runc --systemd-cgroup run foo
|
||||
```bash
|
||||
runc spec --rootless
|
||||
jq '.linux.cgroupsPath="user.slice:runc:foo"' config.json | sponge config.json
|
||||
runc --systemd-cgroup run foo
|
||||
```
|
||||
|
||||
The container processes are executed in a cgroup like `/user.slice/user-$(id -u).slice/user@$(id -u).service/user.slice/runc-foo.scope`.
|
||||
@@ -60,11 +60,11 @@ memory pids
|
||||
|
||||
To allow delegation of other controllers, you need to change the systemd configuration as follows:
|
||||
|
||||
```console
|
||||
# mkdir -p /etc/systemd/system/user@.service.d
|
||||
# cat > /etc/systemd/system/user@.service.d/delegate.conf << EOF
|
||||
```bash
|
||||
sudo mkdir -p /etc/systemd/system/user@.service.d
|
||||
cat <<EOF | sudo tee /etc/systemd/system/user@.service.d/delegate.conf
|
||||
[Service]
|
||||
Delegate=cpu cpuset io memory pids
|
||||
EOF
|
||||
# systemctl daemon-reload
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
+8
-8
@@ -35,8 +35,8 @@ descriptors to preserve. Instead, it takes how many file descriptors (not
|
||||
including `stdio` or `LISTEN_FDS`) should be passed to the container. In the
|
||||
following example:
|
||||
|
||||
```
|
||||
% runc run --preserve-fds 5 <container>
|
||||
```bash
|
||||
runc run --preserve-fds 5 <container>
|
||||
```
|
||||
|
||||
`runc` will pass the first `5` file descriptors (`3`, `4`, `5`, `6`, and `7` --
|
||||
@@ -46,8 +46,8 @@ In addition to `--preserve-fds`, `LISTEN_FDS` file descriptors are passed
|
||||
automatically to allow for `systemd`-style socket activation. To extend the
|
||||
above example:
|
||||
|
||||
```
|
||||
% LISTEN_PID=$pid_of_runc LISTEN_FDS=3 runc run --preserve-fds 5 <container>
|
||||
```bash
|
||||
LISTEN_PID=$pid_of_runc LISTEN_FDS=3 runc run --preserve-fds 5 <container>
|
||||
```
|
||||
|
||||
`runc` will now pass the first `8` file descriptors (and it will also pass
|
||||
@@ -136,8 +136,8 @@ not a terminal (some `ssh` implementations only look for a terminal on stdin).
|
||||
|
||||
Another way is to run runc under the `script` utility, like this
|
||||
|
||||
```console
|
||||
$ script -e -c 'runc run <container>'
|
||||
```bash
|
||||
script -e -c 'runc run <container>'
|
||||
```
|
||||
|
||||
[tty_ioctl(4)]: https://linux.die.net/man/4/tty_ioctl
|
||||
@@ -150,8 +150,8 @@ the contained process (this is not necessarily the same as `--preserve-fds`'s
|
||||
passing of file descriptors -- [details below](#runc-modes)). As an example
|
||||
(assuming that `terminal: false` is set in `config.json`):
|
||||
|
||||
```
|
||||
% echo input | runc run some_container > /tmp/log.out 2> /tmp/log.err
|
||||
```bash
|
||||
echo input | runc run some_container > /tmp/log.out 2> /tmp/log.err
|
||||
```
|
||||
|
||||
Here the container's various `stdio` file descriptors will be substituted with
|
||||
|
||||
Reference in New Issue
Block a user