Docker and Django

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 startapp directly from the container to start a new app using:

  • Starting a container only after the previous container is Running
  • Where pulled images of docker are stored in Windows?
  • Is it possible to expose a usb device to a lxc/docker container?
  • Kubernetes Limits (1.2) not enforced
  • Docker Connect to Remote Instance of WordPress
  • Docker Compose - How to store database data?
  • docker-compose run web ./ 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?

  • why docker container still can communicate with outside when i shutdown the iptables
  • Reconstruct docker run command parameters from container
  • Jenkins pipeline: docker.withServer(…) does not execute docker commands on remote server
  • Creating first docker container: Can't find host system file on build
  • aws ecs 403 error to login private registry
  • How to run Docker inside Jenkins which is running as container
  • One Solution collect form web for “Docker and Django”

    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, ./ 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.