lxc(7) lxc(7) NAME lxc - Linux man , , . /usr/bin/lxc-execute -n foo -f /usr/share/doc/lxc/examples/lxc-macvlan.conf /bin/bash . (aka. ) . linux (lxc) . . , Checkpoint/Restart . lxc , , . lxc , . , , . . * General setup * Control Group support -> Namespace cgroup subsystem -> Freezer cgroup subsystem -> Cpuset support -> Simple CPU accounting cgroup subsystem -> Resource counters -> Memory resource controllers for Control Groups * Group CPU scheduler -> Basis for grouping tasks (Control Groups) * Namespaces support -> UTS namespace -> IPC namespace -> User namespace -> Pid namespace -> Network namespace * Device Drivers * Character devices -> Support multiple instances of devpts * Network device support -> MAC-VLAN support -> Virtual ethernet pair device * Networking * Networking options -> 802.1d Ethernet Bridging * Security options -> File POSIX Capabilities 3.10 lxc . . lxc-checkconfig . . mount -t cgroup cgroup /cgroup . cgmanager, cgroup-lite systemd , /sys/fs/cgroup cgroup . , . / . ? , . pid sysv ipc . , rootfs . sshd , . , , /var/run/httpd.pid , /var/run . , . . /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 . resolv.conf . /etc/resolv.conf /home/root/debian/rootfs/etc/resolv.conf 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 . . . lxc-execute -n foo [-f config] /bin/bash lxc-start -n foo [-f config] [/bin/bash] lxc-execute lxc-init . lxc-init , . ( ) , lxc-init 1 pid , 2 pid . lxc-start . pid 1. , lxc.init.cmd . , /sbin/init . , lxc-execute , lxc-start . , , , lxc-stop . lxc-stop -n foo TTY tty , tty . tty . tty . lxc-console -n foo -t 3 / . . lxc-freeze -n foo . lxc-unfreeze -n foo . cgroup freezer . , , . . lxc-ls 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" . . , lxc-cgroup . lxc-cgroup . , . . lxc-cgroup -n foo cpuset.cpus . lxc-cgroup -n foo cpu.shares 512 . lxc . , API . 1.0.0 . 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-05 lxc(7)