mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
69 lines
1.5 KiB
Markdown
69 lines
1.5 KiB
Markdown
# Linux Container Runtime
|
|
|
|
## TL;DR
|
|
|
|
```sh
|
|
# install lxc
|
|
apt-get install lxc
|
|
snap install lxd
|
|
|
|
# list available templates
|
|
ls /usr/share/lxc/templates
|
|
|
|
# create a new container
|
|
# use the download template to choose from a list of distribution
|
|
lxc-create --name container-name --template download
|
|
|
|
# start a container
|
|
lxc-start --name container-name
|
|
lxc-start --name container-name --foreground
|
|
lxc-start --name container-name --daemon --define CONFIGVAR=VALUE
|
|
|
|
# stop a container
|
|
lxc-stop --name container-name
|
|
lxc-stop --name container-name --kill
|
|
|
|
# destroy a container
|
|
# needs the container to be stopped
|
|
lxc-destroy --name container-name
|
|
|
|
# get a container status
|
|
lxc-info --name container-name
|
|
|
|
# get the status of all containers
|
|
lxc-ls --fancy
|
|
|
|
# get a shell inside a container
|
|
lxc-attach --name container-name
|
|
|
|
# get config options on man
|
|
man 5 lxc.container.conf
|
|
man lxc.container.conf.5
|
|
man lxc.container.conf(5)
|
|
```
|
|
|
|
## Create new containers as unprivileged user
|
|
|
|
```sh
|
|
# allow user vagrant to create up to 10 veth devices connected to the lxcbr0 bridge
|
|
echo "vagrant veth lxcbr0 10" | sudo tee -a /etc/lxc/lxc-usernet
|
|
```
|
|
|
|
## Further readings
|
|
|
|
- [Website]
|
|
- [Getting started guide][getting started]
|
|
|
|
## Sources
|
|
|
|
All the references in the [further readings] section, plus the following:
|
|
|
|
<!-- project's references -->
|
|
[getting started]: https://linuxcontainers.org/lxc/getting-started/
|
|
[website]: https://linuxcontainers.org/
|
|
|
|
<!-- internal references -->
|
|
[further readings]: #further-readings
|
|
|
|
<!-- external references -->
|