1

i have been trying to dockerize an angular project, using Docker Desktop for windows, with linux containers, and Hyper-V.

Here is my dockerfile:

FROM node:alpine

WORKDIR /var/app

EXPOSE 4200

COPY package*.json ./
COPY proxy*.json ./

COPY . .
RUN npm install @angular/cli -g
#Custom dependencies
RUN npm config set registry http://maven.corp.com.br:8081/artifactory/api/npm/
RUN npm install

RUN npm run build:dev

ENTRYPOINT npm start

i build it and can run it just fine with:

docker build -t name .

docker run -p 4200:4200 name

The problem is, when i try to access https://localhost:4200 from my windows pc, i get ERR_CONNECTION_CLOSED.

However, if i go into the container cli, and use Links (the command line web browser https://i.sstatic.net/xOg5O.gif) to access the url, it works just fine, i'm just having issues trying to access it from my windows pc.

I tried using the host.docker.domain dns aswell but no success.

Any help will be greatly appreciated.

Thanks!

1

2 Answers 2

1

change ENTRYPOINT npm start to

ENTRYPOINT npm start -- --host 0.0.0.0 --disable-host-check

or update package.json

"start": "ng serve --host 0.0.0.0 --disable-host-check",

Sign up to request clarification or add additional context in comments.

Comments

1

Thank you very much @paltaa , all i had to do was change from "npm start" to a custom "ng serve" with the flag --host 0.0.0.0"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.