I am confused on how the named data-volume (not data container) should be used.
I have a named data volume app_src
that is mounted to /usr/src/app
using docker compose file. However, after making changes to my source code (locally), building the image doesn't update the volume.
I am building the image like so,
docker-compose -f development.yml build
and running it docker-compose -f development.yml up -d
.
To confirm that the volume doesn't change, I attached into the running container and true enough, the source code isn't updated.
Here is my docker compose file development.yml
and Dockerfile
for my web
service.
version: '2'
services:
web:
restart: always
build: ./web
expose:
- "8000"
volumes:
- app_src:/usr/src/app
links:
- postgres:postgres
env_file: development.env
command: ./start_web.sh
volumes:
app_src: {}
FROM python:3.4.4
WORKDIR /usr/src/app
RUN rm -rf /usr/src/app/*
COPY . /usr/src/app/
RUN pip install --no-cache-dir -r requirements.txt
I could make it work by mounting the host like so,
volumes:
- ./web/src:/usr/src/app
I'm on Ubuntu 16.04 running docker 1.11.2. Is my understanding wrong? I did take a look at the documentation but I could find anything that explained the volume really well.
docker-compose up
-> I want to clear the vol dir and copy the latest file from host? – Fastness