Skip to content

Commit 4e29b63

Browse files
authored
Merge pull request #2185 from candrews/patch-1
docs: Use numeric uid instead of username in Dockerfile
2 parents 6502c3e + 655ca34 commit 4e29b63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/BestPractices.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ You can also include Tini [directly in your Dockerfile](https://github.com/krall
9898

9999
## Non-root User
100100

101-
By default, Docker runs commands inside the container as root which violates the [Principle of Least Privilege (PoLP)](https://en.wikipedia.org/wiki/Principle_of_least_privilege) when superuser permissions are not strictly required. You want to run the container as an unprivileged user whenever possible. The node images provide the `node` user for such purpose. The Docker Image can then be run with the `node` user in the following way:
101+
By default, Docker runs commands inside the container as root which violates the [Principle of Least Privilege (PoLP)](https://en.wikipedia.org/wiki/Principle_of_least_privilege) when superuser permissions are not strictly required. You want to run the container as an unprivileged user whenever possible. The node images provide the `node` user with uid 1000 for such purpose. The Docker Image can then be run with the `node` user in the following way:
102102

103103
```
104104
-u "node"
@@ -110,7 +110,7 @@ Alternatively, the user can be activated in the `Dockerfile`:
110110
FROM node:6.10.3
111111
...
112112
# At the end, set the user to use when running this image
113-
USER node
113+
USER 1000 # node
114114
```
115115

116116
Note that the `node` user is neither a build-time nor a run-time dependency and it can be removed or altered, as long as the functionality of the application you want to add to the container does not depend on it.

0 commit comments

Comments
 (0)