L Clarke
L Clarke

Reputation: 21

Docker mounted volume only updates on container restart

I have a docker container which has NodeJs, npm, jspm & aurelia implemented, my src folder containing the styles, assets, html and js files in mounted on the host file system.

Everything looks fine but when I update html or js in the mounted volume and refresh the web app the changes are not reflected.

My docker file is as follows;

   FROM node:6.1.0
   MAINTAINER   Webnostix [email protected]

   RUN npm install -g jspm
   RUN apt-get -y install git
   RUN npm install aurelia-cli -g
   RUN npm install gulp -g

   # Setup the script to run on startup
   COPY . /var/www/

   EXPOSE 9000 3001
   WORKDIR /var/www/
   CMD npm install -y && au run —watch

I am running the docker container with the following command from my host directory containing my source code

    docker run -it --name AureliaBoilerPlate -v $(pwd):/var/www/src -p 9000:9000 -p 3001:3001 webgnostics/aurelia

Everything runs ok and I can see my web app on the correct port etc.. however code changes made in my local directory only update upon restarting the docker container, which is not what I understand to be how it's supposed to work.

Any ideas??

Upvotes: 2

Views: 5236

Answers (1)

SNO
SNO

Reputation: 866

you can try to let au run --watch run detached using docker-compose. Having that detached a au build refreshs the application as well. Maybe better than restarting the total container everytime.

Getting the application refreshed by code changes currently doesn't work (as far as I know). Also see this discussion here: Github

Following my docker-compose file:

version: '2'

services:
  aurelia-cli-runner:
    image: saschan/aurelia-cli:latest
    ports:
      - "9001:9000"
      - "3001:3001"
    volumes:
      - ./app/:/usr/local/etc/app
    working_dir: //usr/local/etc/app
    command: "au run --watch"

Starting the container detached: docker-compose -f docker-compose.yml up -d

Refreshing the application: au build

Hope, that it helps.

Upvotes: 1

Related Questions