docker-browser-sync icon indicating copy to clipboard operation
docker-browser-sync copied to clipboard

Browser doesn't refresh when making edits on shared volume on host

Open jtcmedia opened this issue 8 years ago • 2 comments

This is a great idea, but doesn't work as intended. Here's my docker compose file:

version: "3"
services:
  node:
    container_name: node
    image: node:6
    user: "node"
    working_dir: /home/node/app
    environment:
      - PORT=8001
      - NODE_ENV=development
    ports:
      - "8001:8001"
    volumes:
      - ./app:/home/node/app
    command: "nodemon -L"
  bs:
    image: ustwo/browser-sync
    ports:
      - "3000:3000"
      - "3001:3001"
    links:
      - node
    volumes:
      - ./app:/source
    command: "start --proxy node:8001 --no-open --files '**/*.pug, **/*.css, **/*.js'"

Everything works, Browsersync says its connected, but any edits made in the shared volume on the host doesn't cause a browser refresh. If I log into the container and make edits in the volume there, it works as intended.

jtcmedia avatar Oct 20 '17 16:10 jtcmedia

did you have any luck making progress with this?

yeahsmaggy avatar May 09 '18 19:05 yeahsmaggy

When I compile scss to css in a local gulp task, the css file within the browsersync container is updated, but it gets an incorrect timestamp. Also the owner of the file is not set to root. If I docker-compose exec browsersync bash into the container and manually touch the style.css file, a browsersync file event is triggered. I use :delegated file mounts, but moving to non-cached or non-delegated mounts doesn't solve the problem. Ran out of ideas on how to fix this. Perhaps running the scss compiler from within the browsersync container will remedy the issue. But that would entail installing gulp / npm there.

vredeling avatar Feb 28 '19 15:02 vredeling