I have a Django project running with docker-compose for dev env.
I’m struggling with file/folder creation on an aws server (AMI ubuntu-bionic)
I mounted a volume on my backend_container with the projects files.
On my local computer, file/folder creation from django inside the container and to the volume works well.
On the server everything seem to work as expected (no errors whatsoever),
but when I
ls to find my folders/files, they aren’t there.
here is the backend service of my docker-compose.yml file
backend: container_name: project_backend_container env_file: - ../project-backend/set_env.env build: context: ../project-backend command: bash -c "python3 manage.py runserver 0.0.0.0:8000" volumes: - ../project-backend/project:/code ports: - "8000:8000" depends_on: - db
I tried to debug it myself, but so far :
when I exec into the container, I can create folders
~/project-backend$ docker exec -it project_backend_container /bin/bash [email protected]:/code# mkdir test [email protected]:/code# ls __pycache__ app manage.py static test uploads project
when I run the shell with django, I can also create folders
[email protected]:/code# python manage.py shell Python 3.7.4 (default, Sep 12 2019, 15:40:15) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> import os >>> os.makedirs('my/awesome/dirs') >>> now exiting InteractiveConsole... [email protected]:/code# ls __pycache__/ app/ manage.py my/ static/ uploads/
I tried to override django storage class to log errors, but everything is going fine.
From the django side, everything looks alright.
My knowledge on docker layers and filesystem management for volume is clearly lacking but I think my problem is related to them.
Has someone already encountered a similar issue and know how to resolve, or at least, debug it ?