Docker and Django manage.py

I’m trying to find a workflow with Docker and Django. Currently, I’m using the basic configuration from the docker documentation.

I’d like to use manage.py startapp directly from the container to start a new app using:

  • Cannot add controller replica to the existing UCP cluster
  • access my docker mysql container in java class
  • Running elasticsearch in docker
  • Vagrant env variable to Docker build
  • Letsencrypt + Docker + Nginx
  • difference between cmd and entrypoint in dockefile
  • docker-compose run web ./manage.py startapp myapp
    

    But all the files created in the volume are owned by the root user and not by myself, so I can’t edit them from the host.

    My idea is to avoid installing all the requirements on my host machine but maybe I should not create app from the container?

    One possible solution is to create a user and make it having the same UID/GID than my user on my host machine but it won’t work if I try to use an other account on my host machine…

    Any suggestion?

  • Unable to start mongodb using supervisor file
  • Creating a testing infrastructure with Pytest , Selenium Grid and Docker
  • Docker container with multiple configurable ports
  • How can I create a docker image from the current system?
  • Range of IP address to be allowed from internal network for Bluemix Containers
  • How can i view my dockerized container app that i just set up on Azure?
  • One Solution collect form web for “Docker and Django manage.py”

    What worked best for me was avoiding (or minimizing) file creation inside the containers.

    My Dockerfile would just copy the requirements.txt and install them;
    and the container would access the app files through a mounted volume.

    I pass the env var PYTHONDONTWRITEBYTECODE=1 to the containers, so python does not create *.pyc/*.pyo files.

    The few times I cannot avoid it (like, ./manage.py makemigrations), I run chown afterwards.
    It’s not ideal, but as this happens rarely for my case, I don’t bother.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.