I recently switched to using almost all Proxmox LXC containers with docker and NFS for all my homelab services. These are the steps I follow to set one up.
Table of contents
Open Table of contents
Set up LXC container with Docker
- Create LXC container with this helper script.
bash -c "$(wget -qLO - https://github.com/community-scripts/ProxmoxVE/raw/main/ct/docker.sh)"
I just use all the default settings. No Portainer, no docker-compose, nothing…
- Make new user “sean”
adduser sean
- Add user to
docker
andsudo
groups
usermod -aG docker sean
usermod -aG sudo sean
- Make docker folder and link it to root directory
mkdir /home/sean/docker
ln -s /home/sean/docker /docker
- Add ssh key to
~/.ssh/authorized_keys
- In Proxmox, set static IP and DNS
- Ensure docker is able to pull images by running the following
docker run hello-world
docker image rm -f hello-world
Setting up NFS
In order to use NFS inside LXC, you need to have a privileged container. Follow these steps to convert your container to privileged in Proxmox.
- Shut down the container if running
- Backup container
- Restore container but change Privilege Level to
Privileged
- Under Options > Features, check the NFS feature
- Boot it up
- Install nfs-common
apt update && apt install -y nfs-common
- Update
/etc/fstab
- Create mountpoints
mkdir /mnt/share1 /mnt/share2 /mnt/share3
- Mount all mountpoints
sudo mount -va