I've been running a few containers for several years. They were all running under rootless Docker with a single user. Initially, I planned to migrate the containers to VMs , but I couldn't get a stable workflow after about two months of effort. Later, gVisor caught my attention , and I decided to migrate to Podman with gVisor instead. The new plan is to run each container with --userns=auto and use Quadlet for systemd integration. This approach provides better isolation and makes writing firewall rules easier. I'm now close to migrating all my containers. Here are a couple of rough edges I'd like to share. Network Layout I compared various networking options and spent a few hours trying the one-interface-per-group approach before giving up. I settled on a single macvlan network and decided to use static IP addresses for my containers. To prevent a randomly assigned IP address from conflicting with a predefined one, I allocated a large IP range for my ...
I want to filter the outgoing network traffic for all of my containers based on a set of rules. For example: Some containers should be blocked from accessing the internet entirely. Some containers should have unrestricted internet access. Some containers should be able to access the internet, but not a specific list of URLs. Some containers should only be allowed to access a specific list of URLs. To manage this, I will define logical policy groups and assign each container to one. As a general rule, only DNS and HTTP/HTTPS traffic will be permitted. Option 1: A Proxy for Each Policy Group Imagine Container A is only allowed to access www.google.com . Here’s how this approach would work: Create an Nginx (or socat ) container that listens on port 443 and acts as a reverse proxy for www.google.com . Place both the Nginx proxy and Container A into an internal container network. Within this network, add www.google.com as a network alias for the Ngin...