![docker network has active endpoints docker network has active endpoints](https://drek4537l1klr.cloudfront.net/stoneman/v-6/Figures/10_08.png)
With reapplication of the ownership and permissions of the non-root user, as the Dockerfile is currently above, the container directory listings look like the following: With reapplication of ownership and permissionsġ3 drwxr-x- 21 nodegoat_docker nodegoat_docker 4.0K Sep 13 08:51. ġ3 drwxr-xr-x 9 nodegoat_docker nodegoat_docker 4.0K Sep 13 09:00 app
![docker network has active endpoints docker network has active endpoints](https://i.stack.imgur.com/cyNdv.png)
![docker network has active endpoints docker network has active endpoints](https://img-blog.csdnimg.cn/20210105104728547.png)
Removing intermediate container f8692fc32cc7ġ1 drwxr-xr-x 32 root root 4.0K Sep 13 09:00. Without reapplying the ownership and permissions of the non-root user as seen above on lines 25 and 26, the container directory listings would look like this: No reapplication of ownership and permissionsġ3 drwxr-xr-x 9 nodegoat_docker nodegoat_docker 4.0K Sep 13 09:00. On lines 25 and 26 we need to reapply ownership and permissions due to the fact that docker does not COPY according to the user you are set to run commands as. But first we need to switch to our non-root user on line 18. On line 15 we change the ownership of the $workdir so our non-root user has access to do the things that we normally have permissions to do without root, such as installing npm packages and copying files, as we see on line 20 and 21. On line 8 we add our non-root user to the image with no ability to login. 24USER rootĢ5RUN chown $user:$user -recursive $workdirĪs you can see on line 4 we create our nodegoat_docker user. 18USER $userĢ2 23 # Permissions need to be reapplied, due to how docker applies root to new files. 15RUN chown $user:$user -recursive $workdirġ6 # Then all further actions including running the containers should 17 # be done under non-root user, unless root is actually required.
#Docker network has active endpoints install#
System account with no ability to login to shell 8RUN useradd -create-home -system -shell /bin/false $userġ3 14 # chown is required by npm install as a non-root user. 4ENV user nodegoat_dockerĦ 7 # Home is required for npm install. 2 3 # Create an environment variable in our image for the non-root user we want to use.