LXC Containers

LXC Containers Cheatsheet #

LXC (Linux Containers) provides a lightweight virtualization method to run multiple Linux systems on a single host.

Container Management #

Command/OptionExampleDescription
lxc-createlxc-create -t ubuntu -n mycontainerCreate a new container with the specified template and name
lxc-startlxc-start -n mycontainerStart the specified container
lxc-stoplxc-stop -n mycontainerStop the specified container
lxc-destroylxc-destroy -n mycontainerDestroy the specified container
lxc-infolxc-info -n mycontainerDisplay information about the specified container

Container Configuration #

Command/OptionExampleDescription
lxc-configlxc-config -lList all configuration options for LXC
lxc-profilelxc-profile -n mycontainerView or modify the profile of a container

Networking #

Command/OptionExampleDescription
lxc-netlxc-net -a 10.0.3.1 -g 10.0.3.0/24Configure network settings for LXC containers
lxc-networklxc-network -n mycontainerDisplay network configuration for a specific container

Container Filesystem #

Command/OptionExampleDescription
lxc-executelxc-execute -n mycontainer -- bashExecute a command inside the container
lxc-attachlxc-attach -n mycontainerAttach to a running container

Container Monitoring #

Command/OptionExampleDescription
lxc-lslxc-lsList all containers on the host
lxc-toplxc-topDisplay resource usage of running containers
lxc-cgrouplxc-cgroup -n mycontainerManage cgroup settings for a specific container

Snapshot Management #

Command/OptionExampleDescription
lxc-snapshotlxc-snapshot -n mycontainerCreate a snapshot of a container
lxc-snapshot -llxc-snapshot -lList all snapshots for containers

Other Commands #

Command/OptionExampleDescription
lxc-configlxc-config -lList all configuration options for LXC
lxc-startlxc-start -n mycontainer -dStart the container in the background

This cheatsheet covers essential LXC container commands and options to help you manage and maintain LXC containers effectively.

LXC Containers

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.