{
    "url": "https://delaparra-services.nl/knowledge-hub/copy",
    "locale": "en",
    "title": "COPY: Knowledge hub | DeLaParra Services",
    "description": "Copies files/directories from the build context into the image. The plain, predictable way to add your source code.",
    "alternates": {
        "en": "https://delaparra-services.nl/knowledge-hub/copy",
        "nl": "https://delaparra-services.nl/nl/kennisbank/copy"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/knowledge-hub/copy.csv",
        "md": "https://delaparra-services.nl/knowledge-hub/copy.md",
        "json": "https://delaparra-services.nl/knowledge-hub/copy.json",
        "zip": "https://delaparra-services.nl/knowledge-hub/copy.zip",
        "pdf": "https://delaparra-services.nl/knowledge-hub/copy.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/knowledge-hub/copy.csv",
            "encodingFormat": "text/csv",
            "name": "copy.csv"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/copy.json",
            "encodingFormat": "application/json",
            "name": "copy.json"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/copy.md",
            "encodingFormat": "text/markdown",
            "name": "copy.md"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/copy.pdf",
            "encodingFormat": "application/pdf",
            "name": "copy.pdf"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/copy.zip",
            "encodingFormat": "application/zip",
            "name": "copy.zip"
        },
        {
            "url": "https://delaparra-services.nl/knowledge-hub/copy/skills.zip",
            "encodingFormat": "application/zip",
            "name": "copy-skills.zip"
        }
    ],
    "markdown": "1. [Home](<https://delaparra-services.nl/>) \n1. [Knowledge hub](<https://delaparra-services.nl/knowledge-hub>) \n1. [COPY](<https://delaparra-services.nl/knowledge-hub/copy>)\n\n  \n\nCategory: Docker \n\n# COPY\n\n  Explained by [Reinier de la Parra](<https://delaparra-services.nl/about>)  Updated November 25, 2026    \n\n## What is COPY?\n\n \n\nCOPY: Copies files/directories from the build context into the image. The plain, predictable way to add your source code. ` COPY ` copies files and folders from the build context into a Docker image. It is the plain, predictable way to add your code, such as ` COPY src ./src `. The order of ` COPY ` lines has a big effect on build speed. Docker caches each step, and a step is rebuilt when the files it copies change. Copy dependency files first, install dependencies, then copy the rest of the code. Then editing a source file does not trigger a full reinstall of every package.\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 COPY\n\n  \n\n### What should you keep in mind with COPY?\n\n \n\nPair it with a ` .dockerignore ` file that excludes ` .git `, ` node_modules `, ` vendor `, local ` .env ` files and logs. That keeps images small and secrets out of them. Use ` --chown ` to set ownership during the copy instead of running a separate ` chown ` step, which would add another large layer to the image.\n\n    \n\n### What does an example of COPY look like?\n\n \n\n```\nCOPY package*.json ./ COPY src ./src\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- [CMD](<https://delaparra-services.nl/knowledge-hub/cmd>) \n- [container](<https://delaparra-services.nl/knowledge-hub/container>) \n- [container DNS](<https://delaparra-services.nl/knowledge-hub/container-dns>) \n- [depends\\_on](<https://delaparra-services.nl/knowledge-hub/depends-on>) \n- [digest](<https://delaparra-services.nl/knowledge-hub/digest>) \n- [Docker Hub](<https://delaparra-services.nl/knowledge-hub/docker-hub>)\n\n \n\n[All terms starting with C](<https://delaparra-services.nl/knowledge-hub#letter-c>)\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/copy/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/copy)\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/copy#webpage",
                "url": "https://delaparra-services.nl/knowledge-hub/copy",
                "name": "COPY: Knowledge hub | DeLaParra Services",
                "description": "Copies files/directories from the build context into the image. The plain, predictable way to add your source code.",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@type": "DefinedTerm",
                    "@id": "https://delaparra-services.nl/knowledge-hub/copy#term",
                    "name": "COPY",
                    "description": "Copies files/directories from the build context into the image. The plain, predictable way to add your source code.",
                    "termCode": "copy",
                    "url": "https://delaparra-services.nl/knowledge-hub/copy",
                    "inLanguage": "en",
                    "keywords": "Docker",
                    "dateModified": "2026-11-25T17:46:25+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/copy#webpage"
                        },
                        {
                            "@id": "https://delaparra-services.nl/knowledge-hub/copy#dataset"
                        }
                    ]
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/copy#breadcrumb"
                },
                "mainEntity": [
                    {
                        "@type": "Question",
                        "name": "What is COPY?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "Copies files/directories from the build context into the image. The plain, predictable way to add your source code. COPY copies files and folders from the build context into a Docker image. It is the plain, predictable way to add your code, such as COPY src ./src. The order of COPY lines has a big effect on build speed. Docker caches each step, and a step is rebuilt when the files it copies change. Copy dependency files first, install dependencies, then copy the rest of the code. Then editing a source file does not trigger a full reinstall of every package."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What should you keep in mind with COPY?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "Pair it with a .dockerignore file that excludes .git, node_modules, vendor, local .env files and logs. That keeps images small and secrets out of them. Use --chown to set ownership during the copy instead of running a separate chown step, which would add another large layer to the image."
                        }
                    },
                    {
                        "@type": "Question",
                        "name": "What does an example of COPY look like?",
                        "acceptedAnswer": {
                            "@type": "Answer",
                            "text": "COPY package*.json ./ COPY src ./src"
                        }
                    }
                ],
                "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/copy#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": "COPY"
                    }
                ]
            },
            {
                "@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/copy#dataset",
                "name": "COPY",
                "description": "Copies files/directories from the build context into the image. The plain, predictable way to add your source code.",
                "url": "https://delaparra-services.nl/knowledge-hub/copy",
                "identifier": "https://delaparra-services.nl/knowledge-hub/copy#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/knowledge-hub/copy#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:25+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": "copy.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/copy.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "copy.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/copy.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "copy.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/copy.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "copy.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/copy.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "copy.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/copy.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "copy-skills.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/knowledge-hub/copy/skills.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-25T17:46:25+00:00",
                        "license": "https://creativecommons.org/licenses/by/4.0/"
                    }
                ]
            }
        ]
    }
}