Docker, Docker Compose, Dockerfile best practices, and multi-service orchestration. Use when writing Dockerfiles, docker-compose.yml, container healthchecks, or working with Docker images, volumes, and networks.
التثبيت
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Docker, Docker Compose, Dockerfile best practices, and multi-service orchestration. Use when writing Dockerfiles, docker-compose.yml, container healthchecks, or working with Docker images, volumes, and networks.
Docker
Project Setup
Use docker-compose.yml for multi-service orchestration
Use Dockerfile for custom images; place in dockerfiles/<service>/Dockerfile
Use .env for configurable ports and credentials (never hardcode)
Use .dockerignore to exclude node_modules, .git, .env, logs
Docker Compose Best Practices
Every service needs a container_name
Use healthcheck with appropriate intervals for all services
Use depends_on with condition: service_healthy for startup ordering
Use named volumes for persistent data (MySQL, MongoDB, Redis)
Use bind mounts only for development code (./src:/app/src)
Always specify restart: unless-stopped or on-failure:N
Use networks to isolate services on a shared bridge network
Dockerfile Best Practices
Use specific base image tags (e.g., php:8.5-apache, not php:latest)
Combine RUN commands with && to reduce layers
Clean up package caches in the same RUN layer (rm -rf /var/lib/apt/lists/*)
Use COPY not ADD unless you need tar extraction
Set WORKDIR before COPY/RUN commands
Use multi-stage builds for compiled languages and Composer
Order COPY by change frequency (package.json first, then source)
Never run as root in production - use USER www-data or equivalent
Include HEALTHCHECK instruction
PHP-Apache Specific
Enable mod_rewrite for clean URLs: a2enmod rewrite
Enable mod_headers for security headers: a2enmod headers
Set AllowOverride All for .htaccess support
Document root: /var/www/httpdocs (mapped from ./server/httpdocs)
PHP extensions via install-php-extensions: gd, pdo_mysql, mysqli, zip, redis, xdebug
PHP config in /usr/local/etc/php/conf.d/php-optimized.ini