From f985119f667e23fd87dc13e0030fa3bb5d959e6d Mon Sep 17 00:00:00 2001 From: medusa Date: Fri, 19 Apr 2024 00:39:43 +0000 Subject: [PATCH] Add docs/tech_docs/proxmox_containers.md --- docs/tech_docs/proxmox_containers.md | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 docs/tech_docs/proxmox_containers.md diff --git a/docs/tech_docs/proxmox_containers.md b/docs/tech_docs/proxmox_containers.md new file mode 100644 index 0000000..371f92f --- /dev/null +++ b/docs/tech_docs/proxmox_containers.md @@ -0,0 +1,69 @@ +## Container Creation + +- Create a new container: + ``` + pct create [OPTIONS] + ``` + - ``: The ID of the new container (integer). + - ``: The path or name of the OS template to use for the container. + +- Example: + ``` + pct create 101 /var/lib/vz/template/cache/openwrt-rootfs.tar.xz --unprivileged 1 --arch amd64 --ostype unmanaged --hostname openwrt-0 --storage local-lvm --net0 name=eth0,bridge=vmbr0,firewall=1 --net1 name=eth1,bridge=vmbr1,firewall=1 + ``` + +## Container Management + +- Start a container: `pct start ` +- Stop a container: `pct stop ` +- Restart a container: `pct restart ` +- Shutdown a container: `pct shutdown ` +- Destroy a container: `pct destroy ` +- Clone a container: `pct clone ` +- Migrate a container: `pct migrate ` +- Resize a container's disk: `pct resize ` + +## Container Configuration + +- Update container configuration: `pct config [OPTIONS]` +- Set container description: `pct set --description ` +- Set container memory: `pct set --memory ` +- Set container CPU cores: `pct set --cores ` +- Set container boot order: `pct set --boot ` +- Add a network device: `pct set --net name=,bridge=,firewall=<1|0>` +- Add a mount point: `pct set --mp ` + +## Container Snapshots + +- Create a snapshot: `pct snapshot ` +- List snapshots: `pct listsnapshot ` +- Restore a snapshot: `pct rollback ` +- Delete a snapshot: `pct delsnapshot ` + +## Container Backup and Restore + +- Backup a container: `vzdump --mode snapshot --compress gzip --storage ` +- Restore a container: `pct restore ` + +## Container Monitoring + +- Show container status: `pct status ` +- Show container resource usage: `pct top ` +- Show container logs: `pct log ` + +## Common Options + +- `--unprivileged 1`: Run the container as an unprivileged user. +- `--arch `: Set the container architecture (e.g., amd64, i386). +- `--ostype `: Set the OS type (e.g., debian, ubuntu, unmanaged). +- `--hostname `: Set the container hostname. +- `--storage `: Set the storage for the container. +- `--net`: Configure network devices for the container. +- `--cpu `: Set the CPU type for the container. +- `--memory `: Set the memory size for the container. +- `--swap `: Set the swap size for the container. +- `--rootfs `: Set the root filesystem for the container. + +This cheatsheet covers the essential commands and options for creating and managing LXC containers in Proxmox using the `pct` command. It includes examples of container creation, management, configuration, snapshots, backup/restore, and monitoring. + +Remember to replace ``, ``, and other placeholders with actual values when using the commands. Adjust the options and parameters according to your specific requirements and environment. \ No newline at end of file