In my team we use Docker containers to locally run our website applications while we do development on them.
Assuming I\'m working on a Flask app at app.py
You can share the host's passwd file:
docker run -ti -v /etc/passwd:/etc/passwd -u `id -u`:`id -g` -v `pwd`:`pwd` -w `pwd` -v pydeps:/usr/local -p 8000:8000 python:3-slim ./manage.py runserver
Or, add the user to the image with useradd
, using /etc
as volume, in the same way you use /usr/local
:
docker run -v etcvol:/etc python..... useradd -u `id -u` $USER
(Both id -u
and $USER are resolved in the host shell, before docker receive the command)