When I did the lab exercise of Chapter 4 I put the USER student before the RUN npm install --omit=dev instruction. The building resulted in the following error:
Error_lab4
Then I put the USER student instruction after the RUN instruction and could finish my lab.
However when I looked at the solution and the demo I see that USER student should be before the RUN command, but I can't get it working.
Can you explain why it is not working for me?
Hi I had today the same problem with 4.18 version of DO188.
I had do move "USER student" after "RUN npm install --omit= dev" instruction to make it work.
Could you check please?
@AlessandraS Sure let me check and get back to you!
@AlessandraS I followed the lab in v4.18 and could complete the lab successfully by following the lab instructions step by step :
@AlessandraS You can see in the above screenshot - the Containerfile instructions that I used and which matches with the course solution.
Refer this : https://github.com/nodejs/docker-node/issues/971
OK thanks, I'll try again and check better my Containerfile
sure @AlessandraS !
Hi @Chetan_Tiwary_ I confirm that using the Containerfile instructions which match with the course solutions everything works fine.
In the Containerfile I created instead, I set the ENV and WORKDIR instructions after the second FROM statement, and this is the case in which an error occurs when building the image from the Containerfile. Why it is not correct to put instructions in this order?
Thanks
My Containerfile
Error I get building the image from it.
It all comes down to permissions. You're setting a working directory and creating files and setting thoes files to be owned by student initially. However, pay attention to ordering and WHO you are WHEN ...
So you are the ROOT user for copying and run commands, then all of a suddent you switch to the STUDENT user before running the npm commands. So you are getting a permission denied when attempting to make and create additional files/directories on the npm install piece.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.