Angular-cli: Docker on windows - Automatic rebuild not triggered on save from host

Created on 3 Mar 2017  Â·  9Comments  Â·  Source: angular/angular-cli

OS?

Windows 10 + Docker CE Version 17.03.0-ce-win1 (10296) + node:latest

Versions.

root@3c96e8d8df57:/app/test-app# node --version
v7.6.0
root@3c96e8d8df57:/app/test-app# ng --version
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0-rc.1
node: 7.6.0
os: linux x64
@angular/common: 2.4.9
@angular/compiler: 2.4.9
@angular/core: 2.4.9
@angular/forms: 2.4.9
@angular/http: 2.4.9
@angular/platform-browser: 2.4.9
@angular/platform-browser-dynamic: 2.4.9
@angular/router: 3.4.9
@angular/cli: 1.0.0-rc.1
@angular/compiler-cli: 2.4.9

Repro steps.

Run up a new docker container with a mounted drive from PowerShell
Install @angular/cli
create a new app
serve the app
make changes from a text editor in the host machine and save
the app does not re-transpile

Commands run are listed below (output removed for brevity)

> docker run -it -p 4200:4200 -p 49153:49153 -v ${pwd}:/app -w /app node /bin/bash
root@3c96e8d8df57:/app# npm i -g @angular/cli
root@3c96e8d8df57:/app# ng new test-app --skip-npm
root@3c96e8d8df57:/app# cd test-app
root@3c96e8d8df57:/app/test-app# npm i 
root@3c96e8d8df57:/app/test-app# ng serve --host 0.0.0.0

Once the app is up and running I open the app folder with VSCode on my host machine and edit a file, for example removing the production mode check in main.ts and save the changes.
I would expect that this action triggers a rebuild of the app as happens when I do this right on the windows host machine

The log given by the failure.

** NG Live Development Server is running on http://0.0.0.0:4200 **
Hash: 8525d0713016ab84cf21
Time: 9365ms
chunk    {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 153 kB {4} [initial] [rendered]
chunk    {1} main.bundle.js, main.bundle.js.map (main) 3.45 kB {3} [initial] [rendered]
chunk    {2} styles.bundle.js, styles.bundle.js.map (styles) 9.77 kB {4} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.69 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.

Mention any other details that might be useful.

Following all of the steps performed inside the container on the host machine results in the expected behavior

Most helpful comment

Hm, ok. I though that Windows would be ok for web development since vagrant and docker but I was wrong. Its time to migrate to Linux I guess.

All 9 comments

With your setup you may need to use the '--poll' option with a reasonable value based on your needs (value is in milliseconds).

Closing as working as intended.

Thank you!!! that has solved the problem Legends :)

'--poll' flag consumes a lot of cpu so this is not a solution.

@Corsseir my 2 cents - this is OS specific and currently I don't believe there is a better way in this combination - docker + Windows

Hm, ok. I though that Windows would be ok for web development since vagrant and docker but I was wrong. Its time to migrate to Linux I guess.

--poll flag doesn't give any results at all, all ports opened, by changing template no webpack rebuild happens

@Corsseir as he said , after '--poll' my pc consume lots of cpu. Are there any way to ho reloding an angular app with docker ?

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings