I basically would like to do something like this: Let's imagine a utility called `layer`.

```
# sudo layer somefile apt install gcc

```

`layer` would launch apt in some sort of container. Apt would think it installs gcc on the actual filesystem but actually it is writing everything into `somefile`. `apt` still has access to the whole filesystem. So it's not like docker.

Then, I could do something like

```
# sudo layer somefile bash
bash# gcc -c foo.c

```

And `bash` would see `gcc` as installed by `apt` even though `gcc` was not actually installed on the system but was installed in `somefile`. Some form of container/jail but which would let access to the rest of the filesystem. My purpose is to create virtual environment for development without polluting my filesystem.

Is there a way to do this?