1. [Home](<https://delaparra-services.nl/>) 
1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) 
1. [USER](<https://delaparra-services.nl/knowledge-hub/user>)

  

Category: Docker 

# USER

  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    

## What is USER?

 

USER: Sets the user (and optionally group) that RUN, CMD, and ENTRYPOINT run as. Use it to avoid running as root. ` USER ` in a Dockerfile sets which user the following ` RUN ` steps, and the container's main process, run as. ` USER app ` switches from root to a normal user named app. By default, containers run as root. If an attacker finds a hole in your application, they then have root rights inside the container, which makes escaping to the host or abusing mounted files much easier.

 

Definition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)

 

## Frequently asked questions about USER

  

### What should you keep in mind with USER?

 

Create a dedicated user in the image, give it ownership of only the folders it needs to write, such as storage and cache, and switch to it before the final command. Many official images already include a suitable user, like ` node ` or ` www-data `. Kubernetes can enforce this with ` runAsNonRoot: true ` in the security context, which refuses to start containers that would run as root.

    

### What does an example of USER look like?

 

```
RUN adduser -D app USER app
```

 

## At a glance

   CategoryDocker Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026

 

## More Docker terms

 

- [tag](<https://delaparra-services.nl/knowledge-hub/tag>) 
- [tag-and-push](<https://delaparra-services.nl/knowledge-hub/tag-and-push>) 
- [tmpfs](<https://delaparra-services.nl/knowledge-hub/tmpfs>) 
- [VOLUME](<https://delaparra-services.nl/knowledge-hub/volume>) 
- [volumes (compose)](<https://delaparra-services.nl/knowledge-hub/volumes-compose>) 
- [WORKDIR](<https://delaparra-services.nl/knowledge-hub/workdir>)

 

[All terms starting with U](<https://delaparra-services.nl/knowledge-hub#letter-u>)

 

## Skills

 

- ### Docker Build Strategies

 

Use this skill when writing, reviewing, or optimizing Dockerfiles, even if the user just says their image is too large, their build is slow, or they need to harden a container for production. Covers multi-stage builds, layer caching, .dockerignore, non-root users, and image size optimization.

 [View skill](<https://delaparra-services.nl/skills/docker-build-strategies>) [Download zip](<https://delaparra-services.nl/skills/docker-build-strategies/download>) 
- ### Multi Stage Dockerfile

 

'Create optimized multi-stage Dockerfiles for any language or framework'

 [View skill](<https://delaparra-services.nl/skills/multi-stage-dockerfile>) [Download zip](<https://delaparra-services.nl/skills/multi-stage-dockerfile/download>) 
- ### Docker Project Foundations

 

Use this skill when setting up, initializing, or Dockerizing a project, even if the user doesn't explicitly mention Docker but describes a need for containerized local development, adding a database or cache dependency, or running services without host-level installs. Covers Dockerfile, compose.yaml, and .dockerignore creation with Docker best practices.

 [View skill](<https://delaparra-services.nl/skills/docker-project-foundations>) [Download zip](<https://delaparra-services.nl/skills/docker-project-foundations/download>)

 [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/user/skills.zip>)

 

## Manuals

 

- [Docker for your Laravel app](<https://delaparra-services.nl/manuals/docker-voor-je-laravel-app>)

 

## Related services

 

- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)

Perhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.

 

## Need any help?

 

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.

  [Get in touch](<https://delaparra-services.nl/availability>)

[HTML version](https://delaparra-services.nl/knowledge-hub/user)
