Preventing container escape in an interactive Linux learning platform
I'm building a platform where people can learn the Linux command line. My backend is Django, Redis, and DRF. The frontend is React. I'm using xterm.js to pair with the Linux images.
After a bit of research, I've realised that container escape is a real possibility, which can lead to my host being compromised. Here are some of the steps I've taken to prevent this and other forms of potential abuse:
• Read-only root filesystem
• gVisor
• Dropped capabilities
• pids_limit=64
• Resource limits
• Socket proxy
• Zero Docker socket exposure
• Separate lab host
• mem_limit=128
• nano_cpus=250_000_000
• security_opt=["no-new-privileges:true"]
However, I feel this is too restrictive, and even complete beginners will have too little to learn.
What measures can I take to enable root in the images without having to worry too much about container escape? What other security measures can I take?