DOCKER

Manage Docker container lifecycle, images, and Compose orchestration.

2|2|Updated Feb 9, 2017
One-click install
npx skills add https://github.com/sumik5/dotfiles --skill docker-sumik5
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: DOCKER
Source: https://github.com/sumik5/dotfiles/tree/main/claude-code/skills/developing-nextjs/DOCKER.md
Command: npx skills add https://github.com/sumik5/dotfiles --skill docker-sumik5

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide explains multi-stage Docker builds, Cloud Run deployment, and best practices for containerized Next.js apps.

Core Features & Use Cases

  • Multi-stage builds: Reduce final image size with builder and runtime stages.
  • Cloud Run deployment: Instructions for deploying to Google Cloud Run.
  • Docker Compose: Development workflows with docker-compose.

Quick Start

Build and run the Next.js app in Docker using a multi-stage Dockerfile.

Frequently Asked Questions about DOCKER

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

FAQPage Schema
How do I build a multi-stage Docker image to reduce container size?

Multi-stage builds use separate builder and runtime stages to exclude build dependencies from the final image. Define multiple FROM statements in your Dockerfile, copy only compiled artifacts to the runtime stage, and Docker discards intermediate layers, significantly reducing final image size for production deployments.

Can I deploy a Next.js app to Google Cloud Run using Docker?

Yes, Cloud Run accepts Docker container images. Build your Next.js app in a Dockerfile, push the image to Container Registry, then deploy via Cloud Run console or CLI. Cloud Run automatically handles scaling and networking for your containerized Next.js application.

How do I set up a local development environment with Docker Compose?

Docker Compose orchestrates multiple containers for development. Define services, volumes, networks, and environment variables in a docker-compose.yml file, then run `docker-compose up` to start all containers. This approach mirrors production architecture locally and simplifies multi-service workflows.

What's the best way to handle environment variables in Docker containers?

Pass environment variables via .env files, docker-compose environment sections, or runtime flags with -e. Store sensitive values securely outside your Dockerfile, reference them in docker-compose or deployment tools, and avoid hardcoding secrets in image layers.

How do I debug a containerized Next.js application?

Use `docker logs` to inspect container output, `docker exec` to run commands inside running containers, and configure health checks in your Dockerfile or docker-compose.yml. Map ports to access the app locally and enable verbose logging to troubleshoot runtime issues.

Do I need Docker Compose for single-container Next.js deployments?

Docker Compose is optional for single containers but valuable for consistent local development. For simple deployments, Docker alone suffices; use Compose when you need multiple services, volumes, networking, or want standardized development and production configurations.