lxc(7) lxc(7) NAME lxc - Linux Linux Kernel cgroup lxc lxc 3.10 lxc lxc lxc- checkconfig PIDsysv IPC rootfs sshd (/var/run/httpd.pid ) /var/run/ rootfs rootfs rootfs bind /etc /home sshd [root@lxc sshd]$ tree -d rootfs rootfs |-- bin |-- dev | |-- pts | `-- shm | `-- network |-- etc | `-- ssh |-- lib |-- proc |-- root |-- sbin |-- sys |-- usr `-- var |-- empty | `-- sshd |-- lib | `-- empty | `-- sshd `-- run `-- sshd [root@lxc sshd]$ cat fstab /lib /home/root/sshd/rootfs/lib none ro,bind 0 0 /bin /home/root/sshd/rootfs/bin none ro,bind 0 0 /usr /home/root/sshd/rootfs/usr none ro,bind 0 0 /sbin /home/root/sshd/rootfs/sbin none ro,bind 0 0 IPv4 init () [root@lxc debian]$ cat fstab /dev /home/root/debian/rootfs/dev none bind 0 0 /dev/pts /home/root/debian/rootfs/dev/pts none bind 0 0 () --------- | STOPPED |<--------------- --------- | | | start | | | V | ---------- | | STARTING |--error- | ---------- | | | | | V V | --------- ---------- | | RUNNING | | ABORTING | | --------- ---------- | | | | no process | | | | | V | | ---------- | | | STOPPING |<------- | ---------- | | | --------------------- lxc.conf(5) lxc-create lxc-destroy lxc-create -n foo lxc-destroy -n foo () lxc-execute lxc-start lxc- stop 2 lxc-execute -n foo [-f config] /bin/bash lxc-start -n foo [-f config] [/bin/bash] lxc-execute lxc-init lxc-init () lxc-init PID 1 PID 2 lxc-start PID 1 lxc- start lxc.init.cmd lxc.init.cmd /sbin/init lxc-execute lxc- start lxc- stop lxc-stop -n foo -k TTY tty tty tty tty tty lxc-console -n foo -t 3 lxc-freeze -n foo lxc-unfreeze -n foo cgroup v1 freezer PID lxc-ls -f lxc-info -n foo lxc-ls lxc-info for i in $(lxc-ls -1); do lxc-info -n $i done lxc-monitor lxc-monitor -n "foo|bar" 'foo' 'bar' lxc-monitor -n ".*" 'foo' 'foo' changed state to [STARTING] 'foo' changed state to [RUNNING] 'foo' changed state to [STOPPING] 'foo' changed state to [STOPPED] lxc-wait (OR) # launch lxc-wait in background lxc-wait -n foo -s STOPPED & LXC_WAIT_PID=$! # this command goes in background lxc-execute -n foo mydaemon & # block until the lxc-wait exits # and lxc-wait exits when the container # is STOPPED wait $LXC_WAIT_PID echo "'foo' is finished" CGROUP control group cgroup cgroup lxc-cgroup lxc-cgroup control group lxc-cgroup -n foo cpuset.cpus lxc-cgroup -n foo cpu.shares 512 SEE ALSO lxc(7), lxc-create(1), lxc-copy(1), lxc-destroy(1), lxc-start(1), lxc- stop(1), lxc-execute(1), lxc-console(1), lxc-monitor(1), lxc-wait(1), lxc-cgroup(1), lxc-ls(1), lxc-info(1), lxc-freeze(1), lxc-unfreeze(1), lxc-attach(1), lxc.conf(5) Version 6.0.0 2024-04-28 lxc(7)