I've been using Docker a lot recently, it's a great way to run old code (think 2016-era Theano code) and ensure reproducible setups across machines. I typically mount my source code as a Docker volume, so I read and write to the directory from my container.

However, because Docker containers are privileged, the output files are owned by root , and I can't even delete them once I return to my system. A quick fix is to launch another Docker container that simply chowns everything in the current directory, recursively:

docker run -it --rm \
    -v $(pwd):/workdir \
    --workdir /workdir \
    alpine \
    chown -R $(id -u):$(id -g) .