A container for every website
, by the developer of PanelCP
Until version 1.2 the panel worked the way most hosting panels do. Every account was a Linux user, every website had its own PHP pool, and one set of server programs served them all. That keeps files apart. It does not keep websites apart: they share one PHP service, one database server and one version of everything.
Since 2.0 each new website is a container. This article shows what that means in practice.
Docker as a wall, not as a product
You do not write Dockerfiles in PanelCP and you cannot run an image from the internet. You choose "PHP 8.4 with Apache" or "Node.js 24", and the panel builds the image on your server and starts it. Docker is only used because it sets up Linux namespaces and limits in a well-tested way.
Every website container starts with these options:
--user <account's uid> never root
--cap-drop ALL no Linux capabilities
--security-opt no-new-privileges
--read-only the system cannot be changed
--memory 512m --cpus 1.00 the defaults, set per website
--pids-limit 512
-p 127.0.0.1:<port>:8080 reachable from the server only
It can write to its own folders and to a temporary folder in memory, and that is all.
One network each
Every website has its own small network. Its database server, MariaDB or PostgreSQL, is on that network and nowhere else. A neighbour cannot try passwords on a database it cannot reach.
This is also why database servers appear and disappear by themselves. The first database of a website starts a server for it, and deleting the last one removes it.
What it costs
Isolation is not free, so I measured it:
- 20 to 50 MB of memory for a small PHP website
- about 100 MB more when it has its own MariaDB
- about 2 GB of disk for the images, shared by all websites that use them
On a VPS with 2 GB that leaves room for a handful of small websites, not for fifty. If you need to squeeze in as many as possible, a panel with shared PHP pools will fit more.
The image gets old, too
A container is as fresh as its image. Every Sunday night the panel rebuilds each image in use from current packages and restarts the websites on it, which takes each one offline for a second or two. Once a week is too slow when a serious hole in PHP is attacked on the day of its release. Until that is better, an administrator can start the rebuild by hand.
What a container does not do
A container shares the kernel with the server. A hole in the kernel can be a way out, which is why updates of the server itself still matter. And from inside a container the server's SSH port and the panel's port can be reached, like from anywhere on the internet. Both are protected by their own sign-in.