Commands for the creation, deletion, inspection, and usage of Linux containers (LXCs).
show lxc status
Prints a table of information about each container which has an entry in the configuration file (/opt/fmadio/etc/time.lua
).
show lxc status
Example output:
[Sat Dec 21 05:23:28 2024] > show lxc status
[Sat Dec 21 05:23:28 2024] Enable : true
[Sat Dec 21 05:23:28 2024] RingCnt : 1
[Sat Dec 21 05:23:28 2024]
[Sat Dec 21 05:23:28 2024] Name OnBoot Install State Desc
[Sat Dec 21 05:23:28 2024] ---------------------------------------------------------------------------------------------------------------------------------
[Sat Dec 21 05:23:28 2024] pcap2dns-20241007-1033 false yes STOPPED hello world
[Sat Dec 21 05:23:28 2024] ubuntu22-202312061042 false yes RUNNING
[Sat Dec 21 05:23:28 2024] market2json-20241102-1207 false yes RUNNING
[Sat Dec 21 05:23:28 2024] ---------------------------------------------------------------------------------------------------------------------------------
show lxc config
Prints the start-up configuration file for one specific container.
show lxc config <container name>
Example output:
[Sat Dec 21 03:04:41 2024] > show lxc config ubuntu22-202312061042
[Sat Dec 21 03:04:41 2024] container configuration is located at
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] /opt/fmadio/lxc/ubuntu22-202312061042/config
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] ---------------------------------------------------------------------------------------------------------------------------------
[Sat Dec 21 03:04:41 2024] # lxc config generated by ubuntu install.lua
[Sat Dec 21 03:04:41 2024] # set cpu to default
[Sat Dec 21 03:04:41 2024] lxc.cgroup.cpuset.cpus=0
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] lxc.include = /usr/share/lxc/config/ubuntu.common.conf
[Sat Dec 21 03:04:41 2024] lxc.arch = x86_64
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] lxc.rootfs.path = dir:/opt/fmadio/lxc/ubuntu22-202312061042/rootfs
[Sat Dec 21 03:04:41 2024] lxc.uts.name = fmadio20v3-508-ubuntu22
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] lxc.net.0.type = veth
[Sat Dec 21 03:04:41 2024] lxc.net.0.link = fmad0
[Sat Dec 21 03:04:41 2024] lxc.net.0.flags = up
[Sat Dec 21 03:04:41 2024] lxc.net.0.ipv4.address = 192.168.255.172/24
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] lxc.net.1.type = veth
[Sat Dec 21 03:04:41 2024] lxc.net.1.link = man0
[Sat Dec 21 03:04:41 2024] lxc.net.1.flags = up
[Sat Dec 21 03:04:41 2024] lxc.net.1.ipv4.address = 192.168.108.16/24
[Sat Dec 21 03:04:41 2024] lxc.net.1.ipv4.gateway = 192.168.108.30
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] # Mount Data Directory
[Sat Dec 21 03:04:41 2024] lxc.mount.entry = /mnt/store0/lxc/data/ubuntu22-202312061042 mnt/data/ none bind,create=dir 0 0
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] # Mount Log Directory
[Sat Dec 21 03:04:41 2024] lxc.mount.entry = /mnt/store0/log/lxc/ubuntu22-202312061042 mnt/log/ none bind,create=dir 0 0
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] lxc.prlimit.nofile = 65535
[Sat Dec 21 03:04:41 2024] lxc.prlimit.memlock = unlimited
[Sat Dec 21 03:04:41 2024]
[Sat Dec 21 03:04:41 2024] ---------------------------------------------------------------------------------------------------------------------------------
config lxc add
Register a container located in /opt/fmadio/lxc/
with the system configuration.
config lxc add <container name>
Example output:
[Sat Dec 21 06:33:52 2024] > config lxc add suricata-202310240810
[Sat Dec 21 06:33:54 2024] Added container [suricata-202310240810] to the configuration
config lxc del
Deletes an LXC’s entry in the host system’s /opt/fmadio/etc/time.lua
file. Note that this does not delete the container’s files.
config lxc del <container name>
Example output:
[Sun Dec 22 00:48:12 2024] > config lxc del suricata-202310240810
[Sun Dec 22 00:48:13 2024] Removed container [suricata-202310240810] from the configuration
config lxc boot
Sets an LXC to automatically start when the host system boots.
config lxc boot <container name>
Example output:
[Sat Dec 21 02:40:59 2024] > config lxc boot ubuntu22-202312061042
[Sat Dec 21 02:41:00 2024] Set container [ubuntu22-202312061042] to boot on system start
config lxc no-boot
Sets an LXC to not automatically start when the host system boots.
config lxc no-boot <container name>
Example output:
[Sat Dec 21 02:41:07 2024] > config lxc no-boot ubuntu22-202312061042
[Sat Dec 21 02:41:08 2024] Set container [ubuntu22-202312061042] to NOT boot on system start
config lxc desc
Assigns a description to an LXC, stored in /opt/fmadio/etc/time.lua
, for use as internal documentation.
config lxc desc <container name> <description>
Example output:
[Sat Dec 21 02:40:25 2024] > config lxc desc ubuntu22-202312061042 "quick brown fox jumped over the lazy dog"
[Sat Dec 21 02:40:25 2024] Set container [ubuntu22-202312061042] to description to [quick brown fox jumped over the lazy dog]
config lxc start
Starts the specified LXC.
config lxc start <container name>
Example output:
[Sat Dec 21 02:28:20 2024] > config lxc start ubuntu22-202312061042
[Sat Dec 21 02:28:20 2024] sudo lxc-start -n ubuntu22-202312061042 --logfile /tmp/lxc_ubuntu22-202312061042_1734748100247774976
[Sat Dec 21 02:28:21 2024]
[Sat Dec 21 02:28:21 2024] use the following on a shell to attach to the containers console
[Sat Dec 21 02:28:21 2024] sudo lxc-attach -n ubuntu22-202312061042
config lxc stop
Stops the specified LXC.
config lxc stop <container name>
Example output:
[Sat Dec 21 02:27:43 2024] > config lxc stop ubuntu22-202312061042
[Sat Dec 21 02:27:45 2024] sudo lxc-stop -n ubuntu22-202312061042 --logfile /tmp/lxc_ubuntu22-202312061042_1734748065322511104
config lxc attach
Start a new shell in an LXC.
config lxc attach <container name>
Example output:
[Sat Dec 21 02:13:32 2024] > config lxc attach ubuntu22-202312061042
[Sat Dec 21 02:13:33 2024] sudo lxc-attach -n ubuntu22-202312061042
root@fmadio20v3-508-ubuntu22:/#