The official PVE FAQ recommends to place docker containers in VM's. (LXC vs LXD vs Proxmox Containers vs Docker)
There are also numerous posts here in the forum that recommend to use VM's.
However, there are tons of tutorials on using CT (LXC) to run Docker containers on Proxmox.
What exactly is the reason VM's are recommended?
Here some pros and cons I can come up with, and I like the help of the community to put together a post that gives an informed recommendation for different use cases.
Docker in a CT (LXC)
pro
Docker in a VM
pro
Do you agree with my list? What did I forget to mention? Why do you recommend or do not recommend to use CT's to run Docker.
I like to hear your opinion and will update the post accordingly.
My personal scenario
I have rather limited home lab PVE hardware (i5 CPU and 20GB RAM) and a second machine setup as PBS.
For this reason, I like to keep the numbers of VM's at a minimum and use CT's whenever possible.
There are a couple of Docker images I like to use, all of them comparably lightweight applications. (Wireguard, duckdns, nginx-proxy-manager, Heimdall, and probably some more)
Currently, I have all of them inside an Ubuntu 20.04 VM. This means if something goes wrong with my Ubuntu VM, all docker containers will be down.
Ideally, I would like to have a separate CT for each Docker image.
What do you think, does this make sense? Is it idiotic? What do you recommend?
There are also numerous posts here in the forum that recommend to use VM's.
However, there are tons of tutorials on using CT (LXC) to run Docker containers on Proxmox.
What exactly is the reason VM's are recommended?
Here some pros and cons I can come up with, and I like the help of the community to put together a post that gives an informed recommendation for different use cases.
Docker in a CT (LXC)
pro
- less resource hungry
- PBS Backups: single file recovery functionality
- less performance? (some claim it has poor performance)
- Security: less isolated than a VM (but still more than a native docker installation)
- some containers might not work and need the option “privileged container” (security issue)
- PBS Backups take longer
Docker in a VM
pro
- highest possible isolation.
- Docker works like on a native installation.
- PBS Backups are faster
- resource heavy, in particular if one wants one VM for each docker container.
- Backups with PBS: only the entire VM can be restored not single files.
Do you agree with my list? What did I forget to mention? Why do you recommend or do not recommend to use CT's to run Docker.
I like to hear your opinion and will update the post accordingly.
My personal scenario
I have rather limited home lab PVE hardware (i5 CPU and 20GB RAM) and a second machine setup as PBS.
For this reason, I like to keep the numbers of VM's at a minimum and use CT's whenever possible.
There are a couple of Docker images I like to use, all of them comparably lightweight applications. (Wireguard, duckdns, nginx-proxy-manager, Heimdall, and probably some more)
Currently, I have all of them inside an Ubuntu 20.04 VM. This means if something goes wrong with my Ubuntu VM, all docker containers will be down.
Ideally, I would like to have a separate CT for each Docker image.
What do you think, does this make sense? Is it idiotic? What do you recommend?
Last edited: