I use docker-compose for development with Python/Flask. I want my host codebase to sync with one inside docker container but not...
My working directory structure is below:
.
├── Dockerfile
├── docker-compose.yml
├── app.py
└── requirements.txt
I made bind mount from host's current directory to container's /app.
Dockerfile:
FROM python:3.7.3-alpine3.9
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install --upgrade pip && \
pip install -r requirements.txt
COPY . .
CMD gunicorn -b 0.0.0.0:9000 -w 4 app:app
docker-compose.yml:
version: '3'
services:
web:
build: .
ports:
- "4649:9000"
volumes:
- .:/app
When I access http://localhost:4649 I can see correct response so Docker container is working well. However response don't update when I change app.py.
I inspected the container and the result is below
"Mounts": [
{
"Type": "bind",
"Source": "/Users/emp-mac-zakiooo/dev/jinja-pwa",
"Destination": "/app",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
}
],
It looks very right so I have no idea about this problem 😇
OMG I found my files are correctly synced but gunicorn cached them so added --reload to CMD in Dockerfile, and finally it fixed.
Thank you for helping and soooo sorry for my foolishness...!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With