Skip to content

Commit 78acce3

Browse files
committed
lxc: Explain container locations.
1 parent ec2ad55 commit 78acce3

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/config/lxc.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ each container to ranges not in use by the host system. The host ranges must be
2626

2727
Subordinate UIDs and GIDs are assigned by the
2828
[subuid(5)](https://man.voidlinux.org/subuid.5) and
29-
[subgid(5)](https://man.voidlinux.org/subgid.5) files, respectively. The
30-
superuser may launch unprivileged containers in the system store; regular users
31-
may launch unprivileged containers in their individual stores.
29+
[subgid(5)](https://man.voidlinux.org/subgid.5) files, respectively.
3230

3331
To create unprivileged containers, first edit `/etc/subuid` and `/etc/subgid` to
3432
delegate ranges. For example:
@@ -50,11 +48,12 @@ defined in the file do not overlap. In this example, `root` controls UIDs (or,
5048
from `subgid`, GIDs) ranging from 1000000 to 1065535, inclusive; `user` controls
5149
IDs ranging from 2000000 to 2065535.
5250

53-
Before creating a container, the user owning the container will need a
54-
`default.conf` file specifying the subuid and subgid range to use. For
55-
root-owned containers, this file resides at `/etc/lxc/default.conf`; for
56-
unprivileged users, the file resides at `~/.config/lxc/default.conf`. Mappings
57-
are described in lines of the form
51+
Before creating a container, the user owning the container will need an
52+
[lxc.conf(5)](https://man.voidlinux.org/lxc.conf.5) file, `default.conf`,
53+
specifying the subuid and subgid range to use. For root-owned containers, this
54+
file resides at `/etc/lxc/default.conf`; for unprivileged users, the file
55+
resides at `~/.config/lxc/default.conf`. Mappings are described in lines of the
56+
form
5857

5958
```
6059
lxc.idmap = u 0 1000000 65536
@@ -91,10 +90,17 @@ lxc-create -n mycontainer -t download -- \
9190
```
9291

9392
You may substitute another architecture for `x86_64`, and you may specify a
94-
`musl` image by adding `--variant musl` to the end of the command. See the
95-
[LXC Image Server](http://images.linuxcontainers.org) for a list of available
93+
`musl` image by adding `--variant musl` to the end of the command. See the [LXC
94+
Image Server](http://images.linuxcontainers.org) for a list of available
9695
containers.
9796

97+
By default, configurations and mountpoints for system containers are stored in
98+
`/var/lib/lxc`, while configurations for user containers and mountpoints are
99+
stored in `~/.local/share/lxc`. Both of these values can be modified by setting
100+
`lxc.lxcpath` in the relevant `default.conf`. The superuser may launch
101+
unprivileged containers in the system `lxc.lxcpath`; regular users may launch
102+
unprivileged containers in their personal `lxc.lxcpath`.
103+
98104
All containers will share the same subordinate UID and GID maps by default. This
99105
is permissible, but it means that an attacker who gains elevated access within
100106
one container, and can somehow break out of that container, will have similar

0 commit comments

Comments
 (0)