59 lines
591 B
Markdown
59 lines
591 B
Markdown
# lxc
|
|
|
|
## Setup
|
|
|
|
|
|
sudo usermod -a -G lxd $(whoami)
|
|
|
|
## Containers
|
|
|
|
### List
|
|
|
|
```bash
|
|
lxc list
|
|
```
|
|
|
|
### Get Info
|
|
|
|
```bash
|
|
lxc info containername
|
|
```
|
|
|
|
### Create
|
|
|
|
```bash
|
|
lxc launch ubuntu containername
|
|
```
|
|
|
|
### Stop
|
|
|
|
```bash
|
|
lxc stop containername
|
|
```
|
|
|
|
Exec bash on container
|
|
|
|
```bash
|
|
lxc exec $containername bash
|
|
```
|
|
|
|
### Exec multiple commands
|
|
|
|
lxc exec $containername -- bash -c "apt update -y && apt upgrade -y"
|
|
|
|
### delete a container
|
|
|
|
```bash
|
|
lxc rm containername
|
|
#if force required
|
|
lxc rm containername --force
|
|
```
|
|
|
|
### Configuration
|
|
|
|
Edit
|
|
|
|
```bash
|
|
lxc config edit $CONTAINER_NAME
|
|
```
|