dockerfile

Generate optimized Dockerfiles with multi-stage builds and security scanning.

1|Updated Jan 31, 2026
One-click install
npx skills add https://github.com/ryukyagamilight/terminal-skills --skill dockerfile-ryukyagamilight
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dockerfile
Source: https://github.com/ryukyagamilight/terminal-skills/tree/main/docker/dockerfile
Command: npx skills add https://github.com/ryukyagamilight/terminal-skills --skill dockerfile-ryukyagamilight

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and best practices for writing efficient, secure, and optimized Dockerfiles, helping users build better container images.

Core Features & Use Cases

  • Dockerfile Instruction Deep Dive: Explains the usage and best practices for key Dockerfile instructions like FROM, WORKDIR, COPY, RUN, CMD, ENTRYPOINT, ENV, ARG, EXPOSE, VOLUME, USER, and HEALTHCHECK.
  • Best Practice Templates: Offers pre-defined templates for common application stacks (Node.js, Python, Go, Java) to accelerate development.
  • Security Scanning & Linting: Includes commands for security scanning tools (Docker Scout, Trivy, Snyk) and Dockerfile linters (Hadolint, Dockle).
  • Common Scenarios & Troubleshooting: Covers practical use cases like entrypoint scripts, multi-architecture builds, build caching, and provides a troubleshooting guide.

Quick Start

Use the dockerfile skill to generate a best practice Dockerfile for a Node.js application.

Frequently Asked Questions about dockerfile

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write an optimized Dockerfile for a Python application?

To write an optimized Dockerfile for a Python application, use multi-stage builds, leverage build caching, and apply best practice templates to minimize image size and improve security by structuring your RUN, COPY, and WORKDIR instructions efficiently.

What is the best way to secure a Dockerfile and scan for vulnerabilities?

The best way to secure a Dockerfile is to run non-root users and use security scanning tools like Docker Scout, Trivy, or Snyk to detect vulnerabilities, while also using linters like Hadolint to enforce security best practices during the build process.

How do multi-stage builds work in Docker to reduce image size?

Multi-stage builds work in Docker by using multiple FROM instructions to separate the build environment from the final runtime environment, copying only necessary artifacts to the final image, which significantly reduces image size and removes unnecessary build dependencies.

Can I use Hadolint to lint my Dockerfile for best practices?

Yes, you can use Hadolint to lint your Dockerfile for best practices, as it analyzes your Dockerfile instructions and flags common issues, ensuring your container builds follow established community guidelines for structure and security.

Why does my Docker build cache keep invalidating during image creation?

Your Docker build cache invalidates when instructions like COPY or RUN change or when underlying files are modified, so ordering your Dockerfile instructions from least to most frequently changing ensures maximum cache utilization and faster builds.

Do I need to use ENTRYPOINT and CMD together in a Dockerfile?

You should use ENTRYPOINT and CMD together in a Dockerfile to separate the executable application from its default arguments, ensuring flexible container execution while maintaining a consistent entry point across different runtime configurations.