non-root user

An ordinary user account with limited rights, which a container should run its service as.

In more detail

Create one in the Dockerfile and switch with USER. The service can then only write where you allow, which limits the damage from a bug or an attack. Ports below 1024 and some file permissions need adjusting, which is a small price.

Examples

USER nonroot:nonroot
USER 10001
RUN adduser --system --uid 1001 nextjs
USER nextjs
USER app in the Dockerfile, UID 10001 at run time

Related terms

Taught in

References

Certification courses