{
    "url": "https://delaparra-services.nl/skills/docker-project-foundations",
    "locale": "en",
    "title": "Docker Project Foundations | DeLaParra Services",
    "description": "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.",
    "alternates": {
        "en": "https://delaparra-services.nl/skills/docker-project-foundations",
        "nl": "https://delaparra-services.nl/nl/skills/docker-project-foundations"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/skills/docker-project-foundations.csv",
        "md": "https://delaparra-services.nl/skills/docker-project-foundations.md",
        "json": "https://delaparra-services.nl/skills/docker-project-foundations.json",
        "zip": "https://delaparra-services.nl/skills/docker-project-foundations.zip",
        "pdf": "https://delaparra-services.nl/skills/docker-project-foundations.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/skills/docker-project-foundations.csv",
            "encodingFormat": "text/csv",
            "name": "docker-project-foundations.csv"
        },
        {
            "url": "https://delaparra-services.nl/skills/docker-project-foundations.json",
            "encodingFormat": "application/json",
            "name": "docker-project-foundations.json"
        },
        {
            "url": "https://delaparra-services.nl/skills/docker-project-foundations.md",
            "encodingFormat": "text/markdown",
            "name": "docker-project-foundations.md"
        },
        {
            "url": "https://delaparra-services.nl/skills/docker-project-foundations.pdf",
            "encodingFormat": "application/pdf",
            "name": "docker-project-foundations.pdf"
        },
        {
            "url": "https://delaparra-services.nl/skills/docker-project-foundations.zip",
            "encodingFormat": "application/zip",
            "name": "docker-project-foundations.zip"
        },
        {
            "url": "https://delaparra-services.nl/skills/docker-project-foundations/download",
            "encodingFormat": "application/zip",
            "name": "docker-project-foundations-files.zip"
        }
    ],
    "markdown": "# 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 \n\n**Licence** Apache-2.0\n\n \n\n**Source** docker/skills\n\n \n\n**This skill contains executable scripts.**\n\n [Download zip](<https://delaparra-services.nl/skills/docker-project-foundations/download>)   \n\n# Docker Project Foundations\n\n \n\n## Overview\n\n \n\nThis skill guides you in Dockerizing a project from scratch. It focuses on creating the initial Docker file set, choosing a sane layout, and preferring containerized dependencies over host-level installs.\n\n \n\n## When to use this skill\n\n \n\nActivate this skill when:\n\n \n\n- A user asks you to set up, initialize, or Dockerize a project \n- A project needs an initial ` Dockerfile `, ` compose.yaml `, or ` .dockerignore ` and does not have one \n- A user wants to add a service dependency (database, cache, message queue) to a project \n- A user asks how to run or develop a project locally and Docker is available\n\n \n\n## Do not use this skill when\n\n \n\nDo not use this skill when:\n\n \n\n- The user explicitly wants to avoid Docker \n- The project already has a mature Docker setup and only needs minor edits \n- The main task is optimizing an existing ` Dockerfile ` \n- The main task is editing or debugging an existing Compose stack\n\n \n\n## Core guidance\n\n \n\n### Always create these three files\n\n \n\nWhen Dockerizing a project, always produce all three:\n\n \n\n1. **` .dockerignore `** — Create this first so the initial build context is small and safe. See ` assets/dockerignore-example ` for a reference. \n1. **` Dockerfile `** — Create a working starter image definition that the project can build and run with. Start from ` assets/Dockerfile.simple ` and keep its baseline, even for a first scaffold: \n\n- multi-stage build (dependencies, build, and a separate runtime stage) whenever the project has a build or dependency-install step; \n- base image pinned to a specific version (e.g. ` node:22-slim `), never ` latest `; \n- dependency manifests (` package.json ` + lockfile) copied before the source for layer caching; \n- a non-root ` USER ` set in the final stage before ` CMD `/` ENTRYPOINT `. \n1. **` compose.yaml `** — Create a local development stack that includes the application service and any required dependencies. See ` assets/compose-dev.yaml `.\n\n \n\n### npm registry credentials\n\n \n\n- Exclude ` .npmrc ` at every depth with ` **/.npmrc ` in ` .dockerignore `; otherwise a broad source copy can persist credentials in image layers. \n- The Node.js starter mounts ` npmrc ` as a BuildKit secret for both ` npm ci ` steps. Public-package builds need no secret. For private registries, pass the config explicitly: \n\n```\nDOCKER_BUILDKIT=1 docker build --secret id=npmrc,src=\"$HOME/.npmrc\" .\n```\n\n Use the actual config path if the project keeps it elsewhere. Never copy the credential file or pass its values through ` ARG ` or ` ENV `. Dependency scripts run during installation can access the mounted secret; use trusted dependencies and a least-privilege registry token. \n- For private-registry builds through Compose, add this optional override as ` compose.npm.yaml ` alongside the starter's ` compose.yaml `: \n\n```\nservices:\n  app:\n    build:\n      secrets:\n        - npmrc\nsecrets:\n  npmrc:\n    file: ${NPMRC_PATH:?Set NPMRC_PATH to your npm config file}\n```\n\n Build with ` NPMRC_PATH=\"$HOME/.npmrc\" docker compose -f compose.yaml -f compose.npm.yaml build `. This grants build-time access only, not a runtime secret. Public-package builds should omit the override so no credential file is required.\n\n \n\n### Prefer Dockerized dependencies over host installs\n\n \n\nWhen a project needs a database (Postgres, MySQL, MongoDB), cache (Redis, Memcached), queue (RabbitMQ, Kafka), or any other infrastructure service:\n\n \n\n- **Always** define it as a service in ` compose.yaml ` instead of telling the user to install it on the host. \n- **Never** suggest ` brew install postgres `, ` apt install redis `, or similar host-level installs for development dependencies. \n- Use official Docker images from Docker Hub for these services. \n- Configure services with environment variables, not config files baked into images.\n\n \n\n### Bootstrap checklist\n\n \n\n- Name the file ` compose.yaml ` rather than legacy Compose filenames. \n- Put all three files at the project root unless there is a clear multi-service layout that justifies a ` docker/ ` subdirectory. \n- Ensure the initial setup can build and start locally with one command path. \n- Bind published application ports to loopback by default. Widen the host address only when another device must reach the development service. \n- Keep unauthenticated datastores on the Compose network instead of publishing their ports. If local host tools require database access, publish only to loopback. \n- If a development-only credential fallback enables one-command startup, label it clearly and document a ` .env ` override. \n- Use Compose services for local databases, caches, and queues instead of host installs. \n- Keep the first scaffold simple; defer detailed image optimization and advanced Compose tuning to the owning skills. \"Simple\" never means dropping the Dockerfile baseline above (multi-stage, pinned base, non-root ` USER `).\n\n \n\n### Development vs production\n\n \n\n- Development: Use bind mounts for live reload, publish application ports on loopback by default, and enable verbose logging. Keep unauthenticated datastores on the Compose network; publish a datastore port only on loopback when local host tools require it. \n- Production: Use multi-stage builds, copy only built artifacts, do not mount source code, minimize image layers, set appropriate resource limits. \n- Keep a single ` Dockerfile ` that supports both via build stages and build arguments when possible.\n\n \n\n### File placement\n\n \n\n- Place ` Dockerfile ` at the project root (or in a ` docker/ ` subdirectory if the project has multiple services). \n- Place ` compose.yaml ` at the project root. \n- Place ` .dockerignore ` at the project root, next to the ` Dockerfile `.\n\n \n\n## Related skills\n\n \n\n- For Dockerfile optimization, cache strategy, advanced non-root hardening, and image hardening, use ` docker-build-strategies `. The starter baseline above (including a non-root ` USER `) still applies here. \n- For service dependencies, health checks, overrides, volumes, networks, and Compose debugging, use ` docker-compose-patterns `. \n- For destructive Docker CLI commands (` docker system prune `, ` docker rm -f `, image/network/builder pruning) and a cross-product index of destructive-command guardrails, use ` docker-destructive-guardrails `.\n\n \n\n## References\n\n \n\n- ` references/project-structure.md ` — Detailed guidance on Docker project file organization, naming conventions, and multi-service layouts.\n\n \n\n## Assets\n\n \n\n- ` assets/dockerignore-example ` — A comprehensive ` .dockerignore ` for a typical project. \n- ` assets/compose-dev.yaml ` — A development-oriented Compose file with Dockerized dependencies. \n- ` assets/Dockerfile.simple ` — A basic multi-stage Dockerfile following best practices.\n\n \n\n## Scripts\n\n \n\n- **` scripts/verify-setup.sh `** — Checks that required files exist in the current directory and validates its ` compose.yaml `. Run it from the project root, with the script path resolved under this skill's directory: \n\n```\nbash \"<skill-dir>/scripts/verify-setup.sh\" [--help]\n```\n\n Replace ` <skill-dir> ` with the absolute path of the folder that contains this ` SKILL.md `; the ` scripts/ ` path is relative to that folder, not to the project. Do not change into the skill directory first: the script checks the current directory. If the skill directory cannot be resolved, check that ` .dockerignore `, ` Dockerfile `, and ` compose.yaml ` exist in the project root, then run ` docker compose config --quiet `. Exit status is ` 0 ` when verification succeeds or help is requested, ` 1 ` when required files are missing or the Compose configuration is invalid, and ` 2 ` for invalid arguments.\n\n \n\n## Checks\n\n \n\n- ` checks/verification.md ` — Detailed verification checklist for manual review.\n\n \n\n## Files\n\n \n\n- ` LICENSE ` \n- ` SKILL.md ` \n- ` SOURCE.md ` \n- ` agents/openai.yaml ` \n- ` assets/Dockerfile.simple ` \n- ` assets/compose-dev.yaml ` \n- ` assets/dockerignore-example ` \n- ` checks/verification.md ` \n- ` evals/docker-project-foundations.md ` \n- ` references/project-structure.md ` \n- ` scripts/verify-setup.sh ` \n- ` skill.yaml `\n\n \n\n## Related terms\n\n \n\n- [ADD](<https://delaparra-services.nl/knowledge-hub/add>) \n- [anonymous volume](<https://delaparra-services.nl/knowledge-hub/anonymous-volume>) \n- [ARG](<https://delaparra-services.nl/knowledge-hub/arg>) \n- [base image](<https://delaparra-services.nl/knowledge-hub/base-image>) \n- [bind mount](<https://delaparra-services.nl/knowledge-hub/bind-mount>) \n- [bridge](<https://delaparra-services.nl/knowledge-hub/bridge>) \n- [build](<https://delaparra-services.nl/knowledge-hub/build>) \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- [Containerisation](<https://delaparra-services.nl/knowledge-hub/containerisation>) \n- [COPY](<https://delaparra-services.nl/knowledge-hub/copy>) \n- [Daemon](<https://delaparra-services.nl/knowledge-hub/daemon>) \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- [ENTRYPOINT](<https://delaparra-services.nl/knowledge-hub/entrypoint>) \n- [EXPOSE](<https://delaparra-services.nl/knowledge-hub/expose>) \n- [FROM](<https://delaparra-services.nl/knowledge-hub/from>) \n- [HEALTHCHECK](<https://delaparra-services.nl/knowledge-hub/healthcheck>) \n- [healthcheck (compose)](<https://delaparra-services.nl/knowledge-hub/healthcheck-compose>) \n- [host](<https://delaparra-services.nl/knowledge-hub/host>) \n- [image](<https://delaparra-services.nl/knowledge-hub/image>) \n- [layer](<https://delaparra-services.nl/knowledge-hub/layer>) \n- [multi-stage build](<https://delaparra-services.nl/knowledge-hub/multi-stage-build>) \n- [networks (compose)](<https://delaparra-services.nl/knowledge-hub/networks-compose>) \n- [none](<https://delaparra-services.nl/knowledge-hub/none>) \n- [port mapping](<https://delaparra-services.nl/knowledge-hub/port-mapping>) \n- [ports](<https://delaparra-services.nl/knowledge-hub/ports>) \n- [pull](<https://delaparra-services.nl/knowledge-hub/pull>) \n- [push](<https://delaparra-services.nl/knowledge-hub/push>) \n- [registry](<https://delaparra-services.nl/knowledge-hub/registry>) \n- [RUN](<https://delaparra-services.nl/knowledge-hub/run>) \n- [services](<https://delaparra-services.nl/knowledge-hub/services>) \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- [Virtual machine](<https://delaparra-services.nl/knowledge-hub/virtual-machine>) \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[Installing an agent skill in Claude Code, Codex, Cursor and Copilot](<https://delaparra-services.nl/manuals/een-skill-installeren-in-je-ai-assistent>)\n\n[HTML version](https://delaparra-services.nl/skills/docker-project-foundations)\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": "WebPage",
                "@id": "https://delaparra-services.nl/skills/docker-project-foundations#webpage",
                "url": "https://delaparra-services.nl/skills/docker-project-foundations",
                "name": "Docker Project Foundations | DeLaParra Services",
                "description": "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.",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/skills/docker-project-foundations#breadcrumb"
                }
            },
            {
                "@type": "BreadcrumbList",
                "@id": "https://delaparra-services.nl/skills/docker-project-foundations#breadcrumb",
                "itemListElement": [
                    {
                        "@type": "ListItem",
                        "position": 1,
                        "name": "Home",
                        "item": "https://delaparra-services.nl/"
                    },
                    {
                        "@type": "ListItem",
                        "position": 2,
                        "name": "Docker Project Foundations"
                    }
                ]
            },
            {
                "@type": "Person",
                "@id": "https://delaparra-services.nl/#person",
                "name": "Reinier de la Parra",
                "url": "https://delaparra-services.nl/about"
            },
            {
                "@type": "SoftwareSourceCode",
                "@id": "https://delaparra-services.nl/skills/docker-project-foundations#skill",
                "url": "https://delaparra-services.nl/skills/docker-project-foundations",
                "name": "Docker Project Foundations",
                "description": "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.",
                "inLanguage": "en",
                "license": "https://spdx.org/licenses/Apache-2.0.html",
                "subjectOf": {
                    "@id": "https://delaparra-services.nl/skills/docker-project-foundations#dataset"
                }
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/skills/docker-project-foundations#dataset",
                "name": "Docker Project Foundations",
                "description": "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.",
                "url": "https://delaparra-services.nl/skills/docker-project-foundations",
                "identifier": "https://delaparra-services.nl/skills/docker-project-foundations#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/skills/docker-project-foundations#skill"
                },
                "creditText": "docker/skills",
                "publisher": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "license": "https://spdx.org/licenses/Apache-2.0.html",
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "dateModified": "2026-11-28T14:00:11+00:00",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/knowledge-hub#skills",
                    "name": "Skills for AI coding assistants",
                    "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": "docker-project-foundations.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/skills/docker-project-foundations.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:11+00:00",
                        "license": "https://spdx.org/licenses/Apache-2.0.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "docker-project-foundations.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/skills/docker-project-foundations.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:11+00:00",
                        "license": "https://spdx.org/licenses/Apache-2.0.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "docker-project-foundations.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/skills/docker-project-foundations.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:11+00:00",
                        "license": "https://spdx.org/licenses/Apache-2.0.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "docker-project-foundations.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/skills/docker-project-foundations.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:11+00:00",
                        "license": "https://spdx.org/licenses/Apache-2.0.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "docker-project-foundations.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/skills/docker-project-foundations.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:11+00:00",
                        "license": "https://spdx.org/licenses/Apache-2.0.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "docker-project-foundations-files.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/skills/docker-project-foundations/download",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:11+00:00",
                        "license": "https://spdx.org/licenses/Apache-2.0.html"
                    }
                ]
            }
        ]
    }
}