Running as a host user within a Docker container

后端 未结 3 974
抹茶落季
抹茶落季 2021-02-03 23:58

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

3条回答
  •  名媛妹妹
    2021-02-04 00:35

    If it's okay for you to use another Python package to start your container, maybe you want to use my Python package https://github.com/boon-code/docker-inside which overwrites the entrypoint and creates your user in the container on the fly...

    docker-inside -v `pwd`:`pwd` -w `pwd` -v pydeps:/usr/local -e FLASK_APP=app.py -e FLASK_DEBUG=true -p 5000:5000 python:3-slim -- flask run -h 0.0.0.0
    

    Overriding entrypoint on the command line and passing a script that creates your user might also be okay for you, if you want to stick with Docker CLI.

提交回复
热议问题