I
I
Innokenty Ivanov2017-09-30 09:08:02
Nginx
Innokenty Ivanov, 2017-09-30 09:08:02

Docker and angular CLI: why doesn't it work?

I use:

  • Docker latest version
  • Angular CLI version 1.4.3
  • Kitematic latest version
  • Windows 10 Creators Update

Dockerfile:
FROM node:latest AS buildContainer

COPY . /app
WORKDIR /app
# Copy dependency definitions
RUN npm install
RUN npm run build

FROM nginx:latest
RUN apt-get update 

COPY nginx.conf /etc/nginx/nginx.conf
COPY gzip.conf /etc/nginx/gzip.conf
COPY mime.types /etc/nginx/mime.types

COPY --from=buildContainer /app/dist/ /usr/share/nginx/html

EXPOSE 9000/tcp

The image is assembled and launched, however, when I go to the desired localhost: 9000, the server does not return the page. Although in Powershell everything is OK:
[email protected]:/usr/share/nginx/html# ls
50x.html                           index.html            main.bundle.js.map       styles.bundle.js
favicon.ico                        inline.bundle.js      polyfills.bundle.js      styles.bundle.js.map
fontello.078f910f70a2e032f1b6.eot  inline.bundle.js.map  polyfills.bundle.js.map  vendor.bundle.js
fontello.42641586af6054f0f7e6.svg  main.bundle.js        scripts.bundle.js        vendor.bundle.js.map

What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Innokenty Ivanov, 2017-09-30
@Kenya-West

Thanks RidgeA for the help! It turns out that the problem was that I was compiling with the docker build -t [имя_контейнера]. It is not right. You need to download the Docker extension for VS Code and call it to build and run the container, it does all the work. Thanks everyone!

R
RidgeA, 2017-09-30
@RidgeA

Is the docker container running and port 9000 shared when starting the container?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question