{
    "url": "https://delaparra-services.nl/knowledge-hub/workdir",
    "locale": "en",
    "title": "WORKDIR: Knowledge hub | DeLaParra Services",
    "description": "Sets the working directory for subsequent RUN, CMD, COPY, and ENTRYPOINT instructions. Creates it if missing.",
    "alternates": {
        "en": "https://delaparra-services.nl/knowledge-hub/workdir",
        "nl": "https://delaparra-services.nl/nl/kennisbank/workdir"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/knowledge-hub/workdir.csv",
        "md": "https://delaparra-services.nl/knowledge-hub/workdir.md",
        "json": "https://delaparra-services.nl/knowledge-hub/workdir.json",
        "zip": "https://delaparra-services.nl/knowledge-hub/workdir.zip",
        "pdf": "https://delaparra-services.nl/knowledge-hub/workdir.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/knowledge-hub/workdir.csv",
            "encodingFormat": "text/csv",
            "name": "workdir.csv"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/workdir.json",
            "encodingFormat": "application/json",
            "name": "workdir.json"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/workdir.md",
            "encodingFormat": "text/markdown",
            "name": "workdir.md"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/workdir.pdf",
            "encodingFormat": "application/pdf",
            "name": "workdir.pdf"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/workdir.zip",
            "encodingFormat": "application/zip",
            "name": "workdir.zip"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/workdir/skills.zip",
            "encodingFormat": "application/zip",
            "name": "workdir-skills.zip"
        }
    ],
    "markdown": "1. [Home](<https://delaparra-services.nl/>) \n1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) \n1. [WORKDIR](<https://delaparra-services.nl/knowledge-hub/workdir>)\n\n  \n\nCategory: Docker \n\n# WORKDIR\n\n  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    \n\n## What is WORKDIR?\n\n \n\nWORKDIR: Sets the working directory for subsequent RUN, CMD, COPY, and ENTRYPOINT instructions. Creates it if missing. ` WORKDIR ` sets the working folder for the instructions that follow in a Dockerfile, such as ` RUN `, ` COPY `, ` CMD ` and ` ENTRYPOINT `. ` WORKDIR /var/www/html ` creates the folder if needed and makes it the current directory. It is cleaner than writing ` cd ` inside ` RUN ` commands, which only lasts for that one command, and it makes relative paths in the rest of the Dockerfile predictable.\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 WORKDIR\n\n  \n\n### What should you keep in mind with WORKDIR?\n\n \n\nUse absolute paths for ` WORKDIR `, and set it once near the top for your application folder. It also determines where you land when you open a shell in the running container with ` docker exec `, which saves typing during debugging. Combined with ` COPY . . `, it keeps a Dockerfile short and easy to follow.\n\n    \n\n### What does an example of WORKDIR look like?\n\n \n\n```\nWORKDIR /usr/src/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- [USER](<https://delaparra-services.nl/knowledge-hub/user>) \n- [VOLUME](<https://delaparra-services.nl/knowledge-hub/volume>) \n- [volumes (compose)](<https://delaparra-services.nl/knowledge-hub/volumes-compose>)\n\n \n\n[All terms starting with W](<https://delaparra-services.nl/knowledge-hub#letter-w>)\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/workdir/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/workdir)\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/workdir#webpage",
                "url": "https://delaparra-services.nl/knowledge-hub/workdir",
                "name": "WORKDIR: Knowledge hub | DeLaParra Services",
                "description": "Sets the working directory for subsequent RUN, CMD, COPY, and ENTRYPOINT instructions. Creates it if missing.",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@type": "DefinedTerm",
                    "@id": "https://delaparra-services.nl/knowledge-hub/workdir#term",
                    "name": "WORKDIR",
                    "description": "Sets the working directory for subsequent RUN, CMD, COPY, and ENTRYPOINT instructions. Creates it if missing.",
                    "termCode": "workdir",
                    "url": "https://delaparra-services.nl/knowledge-hub/workdir",
                    "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/workdir#webpage"
                        },
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/workdir#dataset"
                        }
                    ]
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/workdir#breadcrumb"
                },
                "mainEntity": [
                    {
                        "@type": "Question",
                        "name": "What is WORKDIR?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "Sets the working directory for subsequent RUN, CMD, COPY, and ENTRYPOINT instructions. Creates it if missing. WORKDIR sets the working folder for the instructions that follow in a Dockerfile, such as RUN, COPY, CMD and ENTRYPOINT. WORKDIR /var/www/html creates the folder if needed and makes it the current directory. It is cleaner than writing cd inside RUN commands, which only lasts for that one command, and it makes relative paths in the rest of the Dockerfile predictable."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What should you keep in mind with WORKDIR?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "Use absolute paths for WORKDIR, and set it once near the top for your application folder. It also determines where you land when you open a shell in the running container with docker exec, which saves typing during debugging. Combined with COPY . ., it keeps a Dockerfile short and easy to follow."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What does an example of WORKDIR look like?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "WORKDIR /usr/src/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/workdir#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": "WORKDIR"
                    }
                ]
            },
            {
                "@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/workdir#dataset",
                "name": "WORKDIR",
                "description": "Sets the working directory for subsequent RUN, CMD, COPY, and ENTRYPOINT instructions. Creates it if missing.",
                "url": "https://delaparra-services.nl/knowledge-hub/workdir",
                "identifier": "https://delaparra-services.nl/knowledge-hub/workdir#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/workdir#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": "workdir.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/workdir.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "workdir.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/workdir.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "workdir.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/workdir.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "workdir.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/workdir.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "workdir.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/workdir.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "workdir-skills.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/workdir/skills.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:31+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    }
                ]
            }
        ]
    }
}