EXPOSE: Documents which port the container listens on. It is metadata only — it does not actually publish the port. EXPOSE in a Dockerfile documents which port the application inside the container listens on, such as EXPOSE 8080. It does not open or publish anything. It is a note for people and tools. Someone reading the Dockerfile knows where the app listens, and docker run -P uses it to publish all exposed ports on random host ports.
To make the port reachable from your computer, you still need -p 8080:8080 with docker run, or a ports entry in Compose. In Kubernetes, the container port and a Service do that job. Keep EXPOSE accurate anyway. It is the quickest way for the next developer to see which port the application expects, without digging through configuration files.
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.
Use this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides.
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.