I have a working Angular 5 app which I am struggling to make working with docker-compose.
Though similar kind of problem has been faced by many people but suggested solution does not work for me:
Access Angular app running inside Docker container
Cannot access nodejs app on browser at localhost:4200 (docker run -p 4200:4200 ....)
nodejs app doesn't connect to localhost when running within a docker container
ng serve not working in Docker container
not able to access angular2 app from docker container
Here is my docker-compose.yml
version: '3' services: webui-ng: container_name: bcrm-webui-ng build: ./webui-angular ports: - 4200:4200 Below is the Docker file which is located under ./webui-angular.
FROM node:9.6.1 # Create app directory WORKDIR /usr/src/app COPY package*.json ./ # Install app dependencies RUN npm install # Bundle app source COPY . . # Expose API port to the outside EXPOSE 4200 # Launch application #CMD ["npm","run ng serve"] #CMD ["npm", "run", "ng", "serve", "--host", "0.0.0.0"] #CMD ["npm", "run", "ng", "serve", "--host", "0.0.0.0", "--port", "4200"] #ENTRYPOINT ["npm", "run", "ng", "serve", "--open", "--host", "0.0.0.0", "--port", "4200"] CMD npm run ng serve --host 0.0.0.0 Please note that all the commands commented on last lines don't work. That is I always get "The connection was reset" error in Firefox when I open http://localhost:4200
Here is command line output
bcrm-webui-ng | bcrm-webui-ng | > [email protected] ng /usr/src/app bcrm-webui-ng | > ng "serve" "0.0.0.0" bcrm-webui-ng | bcrm-webui-ng | ** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 ** bcrm-webui-ng | Date: 2018-09-24T14:03:38.509Z bcrm-webui-ng | Hash: 4ac012def02ed7e0a08a bcrm-webui-ng | Time: 19848ms bcrm-webui-ng | chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered] bcrm-webui-ng | chunk {main} main.bundle.js, main.bundle.js.map (main) 1.81 MB {vendor} [initial] [rendered] bcrm-webui-ng | chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 221 kB {inline} [initial] [rendered] bcrm-webui-ng | chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 28.2 kB {inline} [initial] [rendered] bcrm-webui-ng | chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 4.25 MB [initial] [rendered] bcrm-webui-ng | bcrm-webui-ng | webpack: Compiled successfully.