php - Files changes not reflected in Docker image after rebuild -


i'm trying set 2 docker images php web application (php-fcm) reversed proxied nginx. ideally files of web application copied php-fcm based image , exposed volume. way both containers (web , app) can access files nginx serving static files , php-fcm interpreting php files.

docker-compose.yml

version: '2' services:   web:     image: nginx:latest     depends_on:       - app     volumes:       - ./site.conf:/etc/nginx/conf.d/default.conf     volumes_from:       - app     links:       - app   app:     build: .     volumes:       - /app 

dockerfile:

from php:fpm copy . /app workdir /app 

the above setup works expected. however, when make change files , do

compose --build 

the new files not picked in resulting images. despite following message indicating image indeed being rebuilt:

building app step 1 : php:fpm  ---> cb4faea80358 step 2 : copy . /app  ---> using cache  ---> 660ab4731bec step 3 : workdir /app  ---> using cache  ---> d5b2e4fa97f2 built d5b2e4fa97f2 

only removing old images trick.

any idea cause this?

$ docker --version docker version 1.11.2, build b9f10c9 $ docker-compose --version docker-compose version 1.7.1, build 0a9ab35 

the 'volumes_from' option mounts volumes 1 container another. important word there container, not image. when rebuild image, previous container still running. if stop , restart container, or stop it, other containers still using old mount points. if stop, remove old app container, , start new one, old volume mounts still persist deleted container.

the better way solve in situation switch named volumes , setup utility container update volume.

version: '2' volumes:   app-data:     driver: local  services:   web:     image: nginx:latest     depends_on:       - app     volumes:       - ./site.conf:/etc/nginx/conf.d/default.conf       - app-data:/app   app:     build: .     volumes:       - app-data:/app 

a utility container update app-data volume like:

docker run --rm -it \   -v `pwd`/new-app:/source -v app-data:/target \    busybox /bin/sh -c "tar -cc /source . | tar -xc /target" 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -