This is a wrapper around
docker exec that makes sure to set up a matching user; it also has a pre-script hook. It's kind of janky but it was useful.
It's a lot like Microsoft's `wsl -- command'
Originally written as part of https://github.com/neuropoly/spinalcordtoolbox/blob/916ab591ca2e35cab9f5f27ec2439ce8fdb0b9d2/util/dockerize.sh but that project migrated to Github Actions.
We used it like this:
# if this is a docker job, run in the container instead; but if not just run it here.