0

I have trouble dockerizing my MEAN stack application My angular part (named storage): Dockerfile in dir storage

 FROM node:16.13.0-alpine as node

 WORKDIR /usr/src/app

 COPY package.json package-lock.json ./

 RUN npm i -g @angular/cli 

 RUN npm i bootstrap

 COPY . .

 RUN npm run build

 FROM nginx:1.18.0-alpine

 COPY --from=node /usr/src/app/dist /usr/share/nginx/html

 COPY ./nginx.conf /etc/nginx/conf.d/default.conf

My node and express and database directory named backend

Dockerfile inside backend directory

FROM node:16.13.0-alpine as node

WORKDIR /usr/src/app

COPY package.json package-lock.json ./

RUN npm i -g @angular/cli 

RUN npm i bootstrap

COPY . .

RUN npm run build

FROM nginx:1.18.0-alpine

COPY --from=node /usr/src/app/dist /usr/share/nginx/html

COPY ./nginx.conf /etc/nginx/conf.d/default.conf

And my docker-compose.yml file

version: '3'

services:
  angular:
    hostname: localhost
    build: storage
    ports:
      - "4200:80"
  express:
    build: backend
    ports:
      - "4000:4000"
    links:
      - database

  database:
    image: mongo
    ports:
      - "27017:27017"

I would be very happy if you can check and my code if I am missing something because I making docker-image for the first time..

When I run docker-compose build I get this errors: enter image description here

devZ
  • 606
  • 1
  • 7
  • 23
  • Did you add your current user to the docker group after docker's installation ? If not, try `sudo usermod -aG docker YOUR_USER` – Flo Nov 16 '21 at 17:26
  • Where you say "I get these errors", you've pasted an image file of some sort. Can you replace that with the actual text of the error message? If @Flo is right, does [How to fix docker: Got permission denied issue](https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue) resolve your problem? – David Maze Nov 16 '21 at 17:27
  • I'd also suggest to check if your docker service is running, if using `systemd` check with `service docker status`, if not running try `service docker start` – Noam Yizraeli Nov 16 '21 at 19:53

0 Answers0