We've begun to use containers when creating tools and utilities so individual developers don't have to bother installing prerequisites. Works great, as in:
docker run --rm -v $PWD/input.yaml:/input.yaml our.registry.com/dev/toolA /input.yaml
Until toolA
needs to call another utility, toolB
, that is also wrapped in a container.
Is there a generic way to run a container from within a container, so that it works with docker, podman, or whatever the container-tech-du-jour is without toolA
's caller having to add "scary" extra parameters like e.g. --privileged=true
or -v /var/run/docker.sock:/var/run/docker.sock
?
I'm aware that one can run docker-in-docker, and apparently one can also run podman-in-podman, but that is not recommended. Adding -v /var/run/docker.sock:/var/run/docker.sock
is the recommended approach, but that is docker-only, right?
Because otherwise this is a leaky abstraction. Currently I build toolA
by including the essential bits of the toolB
container in toolA
, making toolA
sensitive to changes in the implementation of toolB
, which I'd like to avoid. Or I could build toolA
but only support docker and require users to add the -v /var/run/docker.sock:/var/run/docker.sock
parameter :-(.
Is there a more elegant way to call toolB
s container from inside toolA
's container that works with all common container techs and doesn't require extra parameters when starting toolA
?