I want to develop on Linux in various languages (python, rust, ...) and will be installing packages through their respective tools (and also some infrastructure like redis, postgresql, ...). I'd like to create a sandbox for each project:
- shell access to run dev and system utilities (perf, htop, etc ...)
- limit access to a few directories where the source code I'll be editing will be (so that I don't have to configure/run my editor for each environment and not not lose any file if the container stops)
- can only do outbound network requests to known package hosting domains (like pypi.org, github.com, etc ...).
- can start servers listening on tcp sockets and access them from within the container without custom configuration
- on occasion allow some port pass-through for localhost only so it the ports can be accessed from another container or from the host system
I'm hoping there are existing tools for it or some detailed tutorials. Some aspects like having the proper list of domains can be tedious to establish/maintain. So far my google searches haven't been yielding anything too promising besides starting from scratch with firejail/docker/lxc/...
I do not want to use VMs to not tax system resources too much as I may have many such environment.
Ideally something like:
dev-env-setup --name myapp --base-container python-dev --shell bash --code ~/coding/myapp
or
dev-env-setup --name myapp --base-container myapp-dev --code ~/coding/myapp --listen-ports 9999,8888,7777 --access-ports 111111,11123