help icon indicating copy to clipboard operation
help copied to clipboard

Angular App Image with non root user

Open tushi0407 opened this issue 6 years ago • 2 comments

I am creating docker image of my angular app using root user.But i want to change it to use non root user.Please help me doing this. Here is my docker file. `FROM docker.com/node:latest as node

WORKDIR /app

COPY . .

RUN npm install

RUN npm run ng build -- --prod

#stage 2 : to run application

FROM docker.com/nginx:alpine

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

tushi0407 avatar Apr 22 '20 07:04 tushi0407

add a USER verb at an appropriate place in the docker file

USER <user>[:<group>]

appropriate means: once you add that, henceforth the rest of the actions will be carried out under that user.

reference: https://docs.docker.com/engine/reference/builder/

gireeshpunathil avatar Nov 05 '20 04:11 gireeshpunathil

answered, closing. feel free to re-open if it is outstanding

gireeshpunathil avatar Dec 09 '20 06:12 gireeshpunathil