{
    "url": "https://delaparra-services.nl/knowledge-hub/user",
    "locale": "en",
    "title": "USER: Knowledge hub | DeLaParra Services",
    "description": "Sets the user (and optionally group) that RUN, CMD, and ENTRYPOINT run as. Use it to avoid running as root.",
    "alternates": {
        "en": "https://delaparra-services.nl/knowledge-hub/user",
        "nl": "https://delaparra-services.nl/nl/kennisbank/user"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/knowledge-hub/user.csv",
        "md": "https://delaparra-services.nl/knowledge-hub/user.md",
        "json": "https://delaparra-services.nl/knowledge-hub/user.json",
        "zip": "https://delaparra-services.nl/knowledge-hub/user.zip",
        "pdf": "https://delaparra-services.nl/knowledge-hub/user.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/knowledge-hub/user.csv",
            "encodingFormat": "text/csv",
            "name": "user.csv"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/user.json",
            "encodingFormat": "application/json",
            "name": "user.json"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/user.md",
            "encodingFormat": "text/markdown",
            "name": "user.md"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/user.pdf",
            "encodingFormat": "application/pdf",
            "name": "user.pdf"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/user.zip",
            "encodingFormat": "application/zip",
            "name": "user.zip"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/user/skills.zip",
            "encodingFormat": "application/zip",
            "name": "user-skills.zip"
        }
    ],
    "markdown": "1. [Home](<https://delaparra-services.nl/>) \n1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) \n1. [USER](<https://delaparra-services.nl/knowledge-hub/user>)\n\n  \n\nCategory: Docker \n\n# USER\n\n  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    \n\n## What is USER?\n\n \n\nUSER: 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.\n\n \n\nDefinition source [Coders Lingo](<https://coderslingo.com/resources/open-dataset/>), [CC BY 4.0](<https://creativecommons.org/licenses/by/4.0/>)\n\n \n\n## Frequently asked questions about USER\n\n  \n\n### What should you keep in mind with USER?\n\n \n\nCreate 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.\n\n    \n\n### What does an example of USER look like?\n\n \n\n```\nRUN adduser -D app USER app\n```\n\n \n\n## At a glance\n\n   CategoryDocker Explained by[Reinier de la Parra](<https://delaparra-services.nl/about>) UpdatedNovember 25, 2026\n\n \n\n## More Docker terms\n\n \n\n- [tag](<https://delaparra-services.nl/knowledge-hub/tag>) \n- [tag-and-push](<https://delaparra-services.nl/knowledge-hub/tag-and-push>) \n- [tmpfs](<https://delaparra-services.nl/knowledge-hub/tmpfs>) \n- [VOLUME](<https://delaparra-services.nl/knowledge-hub/volume>) \n- [volumes (compose)](<https://delaparra-services.nl/knowledge-hub/volumes-compose>) \n- [WORKDIR](<https://delaparra-services.nl/knowledge-hub/workdir>)\n\n \n\n[All terms starting with U](<https://delaparra-services.nl/knowledge-hub#letter-u>)\n\n \n\n## Skills\n\n \n\n- ### Docker Build Strategies\n\n \n\nUse 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.\n\n [View skill](<https://delaparra-services.nl/skills/docker-build-strategies>) [Download zip](<https://delaparra-services.nl/skills/docker-build-strategies/download>) \n- ### Multi Stage Dockerfile\n\n \n\n'Create optimized multi-stage Dockerfiles for any language or framework'\n\n [View skill](<https://delaparra-services.nl/skills/multi-stage-dockerfile>) [Download zip](<https://delaparra-services.nl/skills/multi-stage-dockerfile/download>) \n- ### Docker Project Foundations\n\n \n\nUse 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.\n\n [View skill](<https://delaparra-services.nl/skills/docker-project-foundations>) [Download zip](<https://delaparra-services.nl/skills/docker-project-foundations/download>)\n\n [Download all skills (zip)](<https://delaparra-services.nl/knowledge-hub/user/skills.zip>)\n\n \n\n## Manuals\n\n \n\n- [Docker for your Laravel app](<https://delaparra-services.nl/manuals/docker-voor-je-laravel-app>)\n\n \n\n## Related services\n\n \n\n- [Custom software and web applications](<https://delaparra-services.nl/services#service-03>)\n\nPerhaps your customers need somewhere to download their invoices, or your staff are managing bookings in a spreadsheet.\n\n \n\n## Need any help?\n\n \n\nStuck 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.\n\n  [Get in touch](<https://delaparra-services.nl/availability>)\n\n[HTML version](https://delaparra-services.nl/knowledge-hub/user)\n",
    "structured_data": {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "Organization",
                "@id": "https://delaparra-services.nl/#practice",
                "logo": "https://delaparra-services.nl/logo.png",
                "name": "DeLaParra Services",
                "legalName": "DeLaParra Services",
                "url": "https://delaparra-services.nl/",
                "description": "Bespoke software, web applications and mobile apps, developed in Laravel by a single developer in Groningen. Fixed price agreed in advance, full source code provided upon delivery.",
                "email": "info@delaparra-services.nl",
                "address": {
                    "@type": "PostalAddress",
                    "addressLocality": "Groningen",
                    "addressRegion": "Groningen",
                    "addressCountry": "NL"
                },
                "areaServed": "Groningen, the Netherlands",
                "knowsLanguage": [
                    "en",
                    "nl"
                ],
                "knowsAbout": [
                    "Web design and development",
                    "App development",
                    "Custom software and web applications",
                    "OpenSpec",
                    "AI code review",
                    "Your own coding agent"
                ],
                "founder": {
                    "@id": "https://delaparra-services.nl/#person"
                }
            },
            {
                "@type": "FAQPage",
                "@id": "https://delaparra-services.nl/knowledge-hub/user#webpage",
                "url": "https://delaparra-services.nl/knowledge-hub/user",
                "name": "USER: Knowledge hub | DeLaParra Services",
                "description": "Sets the user (and optionally group) that RUN, CMD, and ENTRYPOINT run as. Use it to avoid running as root.",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@type": "DefinedTerm",
                    "@id": "https://delaparra-services.nl/knowledge-hub/user#term",
                    "name": "USER",
                    "description": "Sets the user (and optionally group) that RUN, CMD, and ENTRYPOINT run as. Use it to avoid running as root.",
                    "termCode": "user",
                    "url": "https://delaparra-services.nl/knowledge-hub/user",
                    "inLanguage": "en",
                    "keywords": "Docker",
                    "dateModified": "2026-11-25T17:46:31+00:00",
                    "inDefinedTermSet": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#terms"
                    },
                    "isPartOf": {
                        "@id": "https://delaparra-services.nl/knowledge-hub#dataset"
                    },
                    "subjectOf": [
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/user#webpage"
                        },
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/user#dataset"
                        }
                    ]
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/user#breadcrumb"
                },
                "mainEntity": [
                    {
                        "@type": "Question",
                        "name": "What is USER?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "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."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What should you keep in mind with USER?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "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."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What does an example of USER look like?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "RUN adduser -D app USER app"
                        }
                    }
                ],
                "author": {
                    "@id": "https://delaparra-services.nl/#person"
                },
                "mentions": [
                    {
                        "@id": "https://delaparra-services.nl/skills/docker-build-strategies#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/skills/multi-stage-dockerfile#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/skills/docker-project-foundations#skill"
                    },
                    {
                        "@id": "https://delaparra-services.nl/manuals/docker-voor-je-laravel-app#article"
                    }
                ]
            },
            {
                "@type": "BreadcrumbList",
                "@id": "https://delaparra-services.nl/knowledge-hub/user#breadcrumb",
                "itemListElement": [
                    {
                        "@type": "ListItem",
                        "position": 1,
                        "name": "Home",
                        "item": "https://delaparra-services.nl/"
                    },
                    {
                        "@type": "ListItem",
                        "position": 2,
                        "name": "Knowledge hub",
                        "item": "https://delaparra-services.nl/knowledge-hub"
                    },
                    {
                        "@type": "ListItem",
                        "position": 3,
                        "name": "USER"
                    }
                ]
            },
            {
                "@type": "Person",
                "@id": "https://delaparra-services.nl/#person",
                "name": "Reinier de la Parra",
                "url": "https://delaparra-services.nl/about"
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/knowledge-hub/user#dataset",
                "name": "USER",
                "description": "Sets the user (and optionally group) that RUN, CMD, and ENTRYPOINT run as. Use it to avoid running as root.",
                "url": "https://delaparra-services.nl/knowledge-hub/user",
                "identifier": "https://delaparra-services.nl/knowledge-hub/user#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/user#term"
                },
                "creator": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "publisher": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "license": "https://creativecommons.org/licenses/by/4.0/",
                "creditText": "Coders Lingo (https://coderslingo.com/resources/open-dataset/), CC BY 4.0",
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "keywords": "Docker",
                "version": "2026-11-25",
                "dateModified": "2026-11-25T17:46:31+00:00",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/knowledge-hub#dataset",
                    "name": "IT terms from A to Z",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "includedInDataCatalog": {
                    "@type": "DataCatalog",
                    "@id": "https://delaparra-services.nl/knowledge-hub#catalog",
                    "name": "Knowledge hub data catalog",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "distribution": [
                    {
                        "@type": "DataDownload",
                        "name": "user.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/user.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "user.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/user.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "user.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/user.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "user.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/user.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "user.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/user.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "user-skills.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/user/skills.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    }
                ]
            }
        ]
    }
}