---
title: How to Deploy LXC Containers on Proxmox VE
url: https://docs.vultr.com/how-to-deploy-lxc-containers-on-proxmox-ve
description: Run unprivileged Debian LXC containers on Proxmox VE on Vultr Bare Metal with NAT networking, DHCP, port forwarding, extra storage, and security isolation.
publish_date: 2026-12-01T16:12:22.564000Z
last_updated: 2026-12-01T16:29:41.446747Z
author: Jivendra Sah
header_image: https://lhr1.vultrobjects.com/docs-main-doc-assets-1/2690/26622864-df7a-43ad-9b99-93c75872b9af.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

[Proxmox Virtual Environment (VE)](https://pve.proxmox.com/pve-docs/) is an open-source virtualization platform based on Debian that runs virtual machines and Linux Containers (LXC) on the same server. A container shares the host's kernel but keeps its own processes, network interfaces, and file system. It has no guest kernel to boot, so it starts in seconds and needs memory only for the applications that it runs. Proxmox VE manages containers through its web interface and the Proxmox Container Toolkit (`pct`) on the command line.

This guide explains how to run an unprivileged Debian 13 container on a Vultr Bare Metal server with Proxmox VE. It covers a private NAT network for internet access, creating and managing containers with `pct`, DHCP for additional containers, port forwarding to a container service, extra storage, and the controls that isolate containers from the host.

## Prerequisites

Before you begin:

* Have access to a [Vultr Bare Metal server](https://www.vultr.com/products/bare-metal/).
* [Install Proxmox VE](https://docs.vultr.com/how-to-install-proxmox-ve-on-a-vultr-bare-metal-server) on the server.
* Create a [non-root user with sudo privileges](https://docs.vultr.com/how-to-create-a-sudo-user-in-linux).

## Differences Between LXC Containers and KVM Virtual Machines

Proxmox VE runs two types of guests. A Kernel-based Virtual Machine (KVM) guest boots its own kernel on virtual hardware, so it can run Windows, FreeBSD, or any Linux distribution. An LXC container is a group of isolated processes on the host's kernel. It skips the virtual hardware and the second kernel, but it can run only Linux, and its isolation depends on the host kernel.

| Feature | LXC Container | KVM Virtual Machine |
| --- | --- | --- |
| Kernel | Shares the host's kernel | Runs its own kernel |
| Guest operating systems | Linux distributions | Linux, Windows, FreeBSD, and others |
| Overhead | Low, with no guest kernel or emulated hardware | Higher, because each guest runs a full operating system |
| Startup | Fast, because only the guest's services start | Slower, because the guest boots firmware, a bootloader, and a kernel |
| Isolation | Enforced by the host kernel | Enforced by hardware virtualization and a separate kernel |
| Best for | Linux services such as web servers, databases, and DNS resolvers | Other operating systems, untrusted workloads, and software that needs a specific kernel |

## Download a Container Template

Proxmox VE builds each container from a template, a compressed root file system of a minimal Linux distribution. The Proxmox VE Appliance Manager (`pveam`) downloads templates from an online catalog and saves them to storage with the **Container template** content type. Container root disks need storage with the **Container** content type. On a default installation, `local` holds templates and `local-lvm` holds root disks.

1. Check the Proxmox VE version.

    ```console
    $ sudo pveversion
    ```

    Verify that the output starts with `pve-manager/9`.

1. List the storage that accepts container templates.

    ```console
    $ sudo pvesm status --content vztmpl
    ```

    Verify that the output lists `local`.

1. List the storage that accepts container root disks.

    ```console
    $ sudo pvesm status --content rootdir
    ```

    Verify that the output lists `local-lvm` or another storage with at least 20 GB available. The containers in this guide use up to 17 GB of storage, and storage names may vary depending on your installation.

    > [!NOTE]
    > Directory storage that you add in the web interface, such as `data1` from the installation guide, accepts only **Disk image** content by default. It appears in this list after you enable the **Container** content type on it.

1. Refresh the template catalog.

    ```console
    $ sudo pveam update
    ```

1. Find the Debian 13 template in the catalog.

    ```console
    $ sudo pveam available --section system | grep debian-13
    ```

    Verify that the output lists a `debian-13-standard` template for `amd64`. This guide uses `debian-13-standard_13.6-1_amd64.tar.zst`. If the catalog has a newer version, use its filename in the following steps.

1. Download the template to the `local` storage.

    ```console
    $ sudo pveam download local debian-13-standard_13.6-1_amd64.tar.zst
    ```

    Verify that the output shows `checksum verified`.

1. List the templates on the `local` storage.

    ```console
    $ sudo pveam list local
    ```

    Verify that `local:vztmpl/debian-13-standard_13.6-1_amd64.tar.zst` appears in the output. The `pct create` command takes this full volume ID as its template.

## Configure a Private Network for Containers

A Bare Metal server has one public IPv4 address, and the Vultr network does not assign addresses to container MAC addresses. A container connected to the public bridge `vmbr0` therefore never receives an IP address. A private bridge solves this. `vmbr1` gets its own subnet, `10.10.10.0/24`, and the host acts as its gateway, using NAT to send container traffic out through `vmbr0` with the server's public address.

1. Back up the network configuration.

    ```console
    $ sudo cp /etc/network/interfaces /etc/network/interfaces.bak
    ```

    If an error in the file breaks the network, use the backup to restore the working configuration.

1. Open the network configuration file.

    ```console
    $ sudo nano /etc/network/interfaces
    ```

1. Add the following bridge definition to the end of the file. Do not change the existing `vmbr0` section.

    ```ini
    auto vmbr1
    iface vmbr1 inet static
            address 10.10.10.1/24
            bridge-ports none
            bridge-stp off
            bridge-fd 0
            post-up   iptables -t nat -C POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE || iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE
            post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE
    ```

    Save and close the file.

    In this configuration:

    * `address`: Assigns the host `10.10.10.1`, the gateway address of the `10.10.10.0/24` subnet.
    * `bridge-ports none`: Creates a bridge with no physical network card.
    * `post-up`: Rewrites the source address of outbound container traffic to the server's public address. The `-C` check adds the rule only if it does not exist yet, so reloading the network does not create duplicate rules.
    * `post-down`: Deletes the NAT rule when the bridge stops.

1. Enable IPv4 forwarding at boot.

    ```console
    $ echo "net.ipv4.ip_forward=1" | sudo tee /etc/sysctl.d/90-lxc-ip-forward.conf
    ```

    Forwarding lets the host route packets between `vmbr1` and `vmbr0`. Files in `/etc/sysctl.d/` apply at every boot.

1. Apply the forwarding setting now.

    ```console
    $ sudo sysctl -p /etc/sysctl.d/90-lxc-ip-forward.conf
    ```

    Verify that the output shows `net.ipv4.ip_forward = 1`.

1. Apply the network configuration.

    ```console
    $ sudo ifreload -a
    ```

1. Check the bridge address.

    ```console
    $ ip -br addr show vmbr1
    ```

    Verify that the output lists `10.10.10.1/24` for `vmbr1`.

1. Allow routed traffic from the private bridge to the public bridge.

    ```console
    $ sudo ufw route allow in on vmbr1 out on vmbr0
    ```

    The Uncomplicated Firewall (UFW) enabled by the installation guide drops routed traffic unless a route rule allows it. UFW allows ping traffic by default, so without this rule, containers can ping external hosts but cannot resolve domain names or download packages.

## Create an LXC Container

An unprivileged container runs without root privileges on the host, even for processes that run as `root` inside it. If a process escapes the container, it has only the permissions of an ordinary user on the host.

Debian 13 includes systemd 257, which isolates many of its services with features that containers can use only when nesting is enabled. The `--features nesting=1` option enables it. Without nesting, `pct` prints `WARN: Systemd 257 detected. You may need to enable nesting.`, and several systemd mount units fail inside the container.

1. Check that container ID `101` is available.

    ```console
    $ sudo pvesh get /cluster/nextid --vmid 101
    ```

    Verify that the output is `101`. If the output reports that the ID is already in use by another container or a virtual machine, run `sudo pvesh get /cluster/nextid` to get the next available ID, and use that ID in place of `101` in the rest of this guide.

1. Create the container.

    ```console
    $ sudo pct create 101 local:vztmpl/debian-13-standard_13.6-1_amd64.tar.zst \
        --hostname debian-lxc \
        --ostype debian \
        --unprivileged 1 \
        --features nesting=1 \
        --cores 1 \
        --memory 1024 \
        --swap 512 \
        --rootfs local-lvm:8 \
        --net0 name=eth0,bridge=vmbr1,ip=10.10.10.10/24,gw=10.10.10.1 \
        --nameserver 1.1.1.1 \
        --onboot 1
    ```

    The container gets one CPU core, 1 GB of memory, 512 MB of swap, and an 8 GB root disk on `local-lvm`. Its `eth0` interface connects to `vmbr1` with the static address `10.10.10.10` in the `10.10.10.0/24` subnet, and it uses `10.10.10.1` as its gateway and `1.1.1.1` as its DNS server. The `--onboot 1` option starts the container automatically when the host boots.

    > [!NOTE]
    > If `pveam list local` shows a newer template, or your root disk storage is not `local-lvm`, change those values in the command.

1. Review the container configuration.

    ```console
    $ sudo pct config 101
    ```

    Verify that `hostname`, `features`, `net0`, `rootfs`, and `unprivileged` match the options in the `pct create` command. The configuration file is `/etc/pve/lxc/101.conf`.

1. Start the container.

    ```console
    $ sudo pct start 101
    ```

    Verify that the command prints no warnings.

1. Check that the container is running.

    ```console
    $ sudo pct status 101
    ```

    Verify that the output shows `status: running`.

1. Ping the private gateway from the container.

    ```console
    $ sudo pct exec 101 -- ping -c 4 10.10.10.1
    ```

    Verify that the output shows `0% packet loss`.

1. Update the container's package index to test DNS resolution and internet access.

    ```console
    $ sudo pct exec 101 -- apt update
    ```

    Verify that the package lists download without `Temporary failure resolving` errors. If that error appears, run `sudo ufw status numbered` and check that the route rule from the previous section is listed.

## Access the Container Shell

`pct enter` attaches a root shell to a running container from the host, so you can work inside the container without an SSH server or a reachable IP address.

1. Open a shell in the container.

    ```console
    $ sudo pct enter 101
    ```

    You are now working inside the container as `root`. Run the remaining commands in this section at the `#` prompt.

1. Check the Debian version.

    ```console
    # cat /etc/os-release
    ```

    Verify that the output shows `VERSION_ID="13"`.

1. Check the systemd state.

    ```console
    # systemctl is-system-running
    ```

    Verify that the output shows `running`. If it shows `degraded`, run `systemctl --failed` to list the failed units.

1. Check the size of the root file system.

    ```console
    # df -h /
    ```

    Verify that `/` shows a size of about 8 GB.

1. Set a root password for console logins, if you need them.

    ```console
    # passwd
    ```

    Enter the new password at both prompts. `pct enter` does not ask for this password, but the login console does.

1. Exit the container shell.

    ```console
    # exit
    ```

    To use the login console later, run `sudo pct console 101` on the host and log in as `root`.

## Manage Containers with the pct Toolkit

`pct` reads and writes the same container configuration as the Proxmox VE web interface, so a change made with one tool appears in the other. Some resource changes apply immediately to a running container, and others remain pending until the container restarts.

1. List the containers on the host.

    ```console
    $ sudo pct list
    ```

    Verify that container `101` appears with the status `running` and the name `debian-lxc`.

1. Run a command in the container without opening a shell.

    ```console
    $ sudo pct exec 101 -- hostname
    ```

    The output shows the container's hostname, `debian-lxc`. Everything after `--` runs inside the container.

1. Increase the container's resources to two CPU cores and 2 GB of memory.

    ```console
    $ sudo pct set 101 --cores 2 --memory 2048
    ```

    The memory limit applies immediately. The core count stays pending until the container restarts.

1. Reboot the container to apply the core count.

    ```console
    $ sudo pct reboot 101
    ```

1. Check the number of CPU cores in the container.

    ```console
    $ sudo pct exec 101 -- nproc
    ```

    Verify that the output shows `2`.

1. Shut down the container.

    ```console
    $ sudo pct shutdown 101
    ```

    `pct shutdown` asks the container to stop its services cleanly. Use `sudo pct stop 101` only when a container does not respond to a shutdown command, because it ends all processes immediately.

1. Start the container again.

    ```console
    $ sudo pct start 101
    ```

1. Check that the container starts when the host boots.

    ```console
    $ sudo pct config 101 | grep onboot
    ```

    Verify that the output shows `onboot: 1`, which the `--onboot 1` option set during creation. To stop the container from starting at boot, run `sudo pct set 101 --onboot 0`.

## Configure a DHCP Server for Containers

Container `101` has a static address. Static addresses work for a few containers, but you must manually track each address as you add more. A DHCP server on `vmbr1` automatically assigns IP addresses, the default gateway, and DNS servers. `dnsmasq` is a small DHCP and DNS server from the Debian repositories. The configuration in this section uses only its DHCP function, with an address pool from `10.10.10.100` to `10.10.10.200` that excludes the static address `10.10.10.10`.

> [!NOTE]
> Two DHCP servers on one bridge can assign the same address to two containers. If Proxmox VE Software-Defined Networking (SDN) or another service already provides DHCP on `vmbr1`, skip this section.

1. Install `dnsmasq` on the host.

    ```console
    $ sudo apt install -y dnsmasq
    ```

1. Create a `dnsmasq` configuration file for the private bridge.

    ```console
    $ sudo nano /etc/dnsmasq.d/lxc-dhcp.conf
    ```

1. Add the following settings:

    ```ini
    port=0
    interface=vmbr1
    bind-interfaces

    dhcp-range=10.10.10.100,10.10.10.200,255.255.255.0,12h
    dhcp-option=option:router,10.10.10.1
    dhcp-option=option:dns-server,1.1.1.1,8.8.8.8
    ```

    Save and close the file.

    `port=0` disables the DNS server, so `dnsmasq` handles only DHCP. `interface=vmbr1` and `bind-interfaces` restrict it to the private bridge, so it never answers DHCP requests on the public network. `dhcp-range` sets the address pool and a 12-hour lease, and the `dhcp-option` lines send containers the gateway `10.10.10.1` and the DNS servers `1.1.1.1` and `8.8.8.8`.

1. Check the configuration for syntax errors.

    ```console
    $ sudo dnsmasq --test
    ```

    Verify that the output shows `syntax check OK`.

1. Allow DHCP requests from the private bridge through UFW.

    ```console
    $ sudo ufw allow in on vmbr1 to any port 67 proto udp
    ```

    Containers send DHCP requests to UDP port 67 on the host. UFW blocks incoming traffic that no rule allows, so without this rule the requests never reach `dnsmasq`.

1. Restart `dnsmasq` to load the configuration.

    ```console
    $ sudo systemctl restart dnsmasq
    ```

1. Check the service status.

    ```console
    $ sudo systemctl status dnsmasq --no-pager
    ```

    Verify that the output shows `active (running)`.

1. Create a test container that requests its address through DHCP.

    ```console
    $ sudo pct create 102 local:vztmpl/debian-13-standard_13.6-1_amd64.tar.zst \
        --hostname debian-dhcp \
        --ostype debian \
        --unprivileged 1 \
        --features nesting=1 \
        --cores 1 \
        --memory 512 \
        --rootfs local-lvm:4 \
        --net0 name=eth0,bridge=vmbr1,ip=dhcp
    ```

    The `ip=dhcp` setting makes the container request an address each time it starts. The test container is smaller than container `101`, with 512 MB of memory and a 4 GB root disk.

1. Start the test container.

    ```console
    $ sudo pct start 102
    ```

1. Display the test container's IPv4 address.

    ```console
    $ sudo pct exec 102 -- ip -4 addr show eth0
    ```

    Verify that `eth0` has an address between `10.10.10.100` and `10.10.10.200`. If `eth0` has no IPv4 address, run `sudo journalctl -u dnsmasq --no-pager` to check the `dnsmasq` log. A log with no `DHCPDISCOVER` entries means that UFW is still blocking the requests.

1. Display the test container's routes.

    ```console
    $ sudo pct exec 102 -- ip -4 route
    ```

    Verify that the default route points to `10.10.10.1`.

1. Shut down the test container.

    ```console
    $ sudo pct shutdown 102
    ```

1. Delete the test container, which the rest of this guide does not use.

    ```console
    $ sudo pct destroy 102 --purge
    ```

    The `--purge` option also removes the container from backup and replication jobs and from high availability settings.

## Publish a Container Service

Containers on `vmbr1` have private addresses, so clients on the internet cannot reach them directly. To publish a container service, the host forwards a port on the server's public address to the container with a destination NAT (DNAT) rule. The Nginx reverse proxy from the installation guide already listens on ports `80` and `443` on the host, so this example forwards port 8080 to port 80 in the container.

1. Install Nginx in the container.

    ```console
    $ sudo pct exec 101 -- apt install -y nginx
    ```

1. Check that Nginx is running in the container.

    ```console
    $ sudo pct exec 101 -- systemctl is-active nginx
    ```

    Verify that the output shows `active`.

1. Open the network configuration file.

    ```console
    $ sudo nano /etc/network/interfaces
    ```

    Add the following lines to the end of the `vmbr1` section, after the `post-down` line. Save and close the file.

    ```ini
            post-up   iptables -t nat -C PREROUTING -i vmbr0 -p tcp --dport 8080 -j DNAT --to-destination 10.10.10.10:80 || iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 8080 -j DNAT --to-destination 10.10.10.10:80
            post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 8080 -j DNAT --to-destination 10.10.10.10:80
    ```

    In this configuration:

    * `post-up`: Forwards TCP connections that reach port 8080 on `vmbr0` to port 80 on `10.10.10.10`. It uses the same `-C` check as the NAT rule.
    * `post-down`: Deletes the forwarding rule when the bridge stops.

1. Apply the network configuration.

    ```console
    $ sudo ifreload -a
    ```

    Running containers stay attached to the bridge during the reload.

1. List the NAT rules for incoming traffic.

    ```console
    $ sudo iptables -t nat -S PREROUTING
    ```

    Verify that the output lists a `DNAT` rule for destination port 8080.

1. Allow the forwarded traffic through UFW.

    ```console
    $ sudo ufw route allow in on vmbr0 out on vmbr1 to 10.10.10.10 port 80 proto tcp
    ```

    Like outbound container traffic, forwarded connections need a UFW route rule. These connections do not pass through the host's input rules, so `sudo ufw allow 8080` does not allow them.

1. Request the page from your local computer. Replace `SERVER_IP` with your server's public IP address.

    ```console
    $ curl http://SERVER_IP:8080
    ```

    Verify that the output contains `Welcome to nginx!`.

## Configure Container Storage

A container's root disk holds its operating system and installed packages. You can increase its size while the container runs, but you cannot reduce it. For application data, attach a mount point: a separate volume that Proxmox VE creates, lists in the container configuration, and can include in container backups. You can resize a separate data volume without changing the root disk.

1. Add 4 GB to the container's root disk.

    ```console
    $ sudo pct resize 101 rootfs +4G
    ```

    `pct resize` expands the volume and the file system inside it in one step, so the container keeps running.

1. Check the new size of the root file system.

    ```console
    $ sudo pct exec 101 -- df -h /
    ```

    Verify that `/` shows a size of about 12 GB.

1. Attach a 5 GB volume to the container at `/srv/data`.

    ```console
    $ sudo pct set 101 --mp0 local-lvm:5,mp=/srv/data,backup=1
    ```

    `local-lvm:5` allocates a new 5 GB volume on `local-lvm`, and `mp=/srv/data` sets its path inside the container. `backup=1` includes the volume in `vzdump` backups of the container.

1. Reboot the container to mount the new volume.

    ```console
    $ sudo pct reboot 101
    ```

1. Check the mounted volume.

    ```console
    $ sudo pct exec 101 -- df -h /srv/data
    ```

    Verify that `/srv/data` shows a size of about 5 GB.

## Container Security Considerations

Every container shares the host's kernel, so a kernel bug or an unsafe container setting can expose the host to the processes inside a container. Unprivileged containers limit what an escaped process can do, and Proxmox VE also uses the following kernel features:

* **AppArmor:** Applies a restrictive profile to each container, blocking sensitive operations such as most mounts and writes to parts of `/proc` and `/sys`.
* **Control groups (cgroups):** Enforce the CPU, memory, and swap limits that you set with `pct`, so one container cannot use the resources that other containers need.
* **Kernel namespaces:** Give each container its own view of processes, network interfaces, mounts, hostnames, and user IDs. In an unprivileged container, the user namespace maps the container's `root` user to user ID `100000` on the host.
* **Seccomp:** Blocks system calls that containers do not need and that could affect the host, such as loading kernel modules.

Apply the following practices to every container that you run.

1. Check that the container is unprivileged and review its features.

    ```console
    $ sudo pct config 101 | grep -E '^(unprivileged|features):'
    ```

    Verify that the output shows `unprivileged: 1` and `features: nesting=1`. Nesting exposes parts of the host's `/proc` and `/sys` to the container, so enable it only for containers that need it, such as Debian 13 with systemd 257.

1. Back up the container before major changes.

    ```console
    $ sudo vzdump 101 --storage local --mode snapshot --compress zstd
    ```

    Verify that the output ends with `Backup job finished successfully`. In snapshot mode, Proxmox VE pauses the container for about a second to take a storage snapshot, and the container keeps running while the backup completes. The archive includes `/srv/data` because its mount point has `backup=1`.

Also follow these guidelines:

* **Limit network exposure:** Forward only the ports that a service needs, and run `sudo ufw status numbered` to review the rules before you change them. The Proxmox VE firewall is disabled by default, so UFW on the host is the only firewall in this setup.
* **Protect container isolation:** Avoid privileged containers, unnecessary nesting, and passing host devices into a container, because each one weakens the isolation between the container and the host. For the same reason, do not disable the AppArmor profile.

## Conclusion

Your Vultr Bare Metal server now runs an unprivileged Debian 13 container on a private NAT network. The container reaches the internet through the host, serves Nginx on the server's public address on port 8080, and stores application data on a separate volume that its backups include. UFW allows only the routed traffic and the ports that you opened, and `dnsmasq` is ready to assign addresses to additional containers. For more information, refer to the [Proxmox VE Linux Container documentation](https://pve.proxmox.com/pve-docs/chapter-pct.html).
