affaan-m/ECC

docker-patterns

Yerel geliştirme, konteyner güvenliği, ağ, volume stratejileri ve multi-servis orkestrasyon için Docker ve Docker Compose kalıpları.

58CollectingNetwork accessRuns scripts
See how to use itView GitHub source
npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/docker-patterns"
Automated source guide

Source checked Jul 28, 2026·Refresh due Oct 26, 2026

Reorganized from the pinned upstream SKILL.md

Turn docker-patterns's source instructions into a guide you can follow

According to the pinned SKILL.md from affaan-m/ECC: Konteynerize edilmiş geliştirme için Docker ve Docker Compose en iyi uygulamaları.

npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/docker-patterns"
Check the pinned source

Best fit

  • Yerel geliştirme, konteyner güvenliği, ağ, volume stratejileri ve multi-servis orkestrasyon için Docker ve Docker Compose kalıpları.

Bring this context

  • A concrete task that matches the documented purpose of docker-patterns.
  • The files, examples, or context the task depends on.
  • Your constraints, target environment, and definition of done.

Expected outputs

  • A result that follows the pinned docker-patterns instructions.
  • A concise record of assumptions, inputs used, and unresolved questions.
  • A final check against the source workflow and relevant permission signals.

Key source sections

Read docker-patterns through these 5 source sections

Sections are extracted automatically from the pinned SKILL.md and link back to the source.

01

Ne Zaman Aktifleştirmeli

Yerel geliştirme için Docker Compose kurarken

SKILL.md · Ne Zaman Aktifleştirmeli
Yerel geliştirme için Docker Compose kurarkenÇok konteynerli mimariler tasarlarkenKonteyner ağ veya volume sorunlarını giderirken
02

Yerel Geliştirme için Docker Compose

Review the “Yerel Geliştirme için Docker Compose” section in the pinned source before continuing.

SKILL.md · Yerel Geliştirme için Docker Compose
Review and apply the “Yerel Geliştirme için Docker Compose” source section.
03

Standart Web Uygulaması Stack'i

Review the “Standart Web Uygulaması Stack'i” section in the pinned source before continuing.

SKILL.md · Standart Web Uygulaması Stack'i
Review and apply the “Standart Web Uygulaması Stack'i” source section.
04

docker-compose.yml

services: app: build: context: . target: dev Multi-stage Dockerfile'ın dev aşamasını kullan ports: - "3000:3000" volumes: - .:/app Hot reload için bind mount - /app/nodemodules Anonim volume -- konteyner bağımlılıklarını korur environment: - DATABASEURL=postgres://postgres:postg…

SKILL.md · docker-compose.yml
"3000:3000".:/app Hot reload için bind mount/app/nodemodules Anonim volume -- konteyner bağımlılıklarını korur
05

Geliştirme vs Üretim Dockerfile

Review the “Geliştirme vs Üretim Dockerfile” section in the pinned source before continuing.

SKILL.md · Geliştirme vs Üretim Dockerfile
Review and apply the “Geliştirme vs Üretim Dockerfile” source section.

SkillSignal prompt templates

Provide the task, context, and acceptance criteria

These prompts were written by SkillSignal from the source structure; they are not upstream text.

Task-start prompt

Confirm source fit, inputs, and outputs before acting.

Use docker-patterns to help me with: [specific task]. Context: [files, data, or background]. Constraints: [environment, scope, and prohibited actions]. Before acting, check the pinned SKILL.md and explain which sections apply, what inputs are still missing, and what you will deliver.

Source-guided execution

Make the Agent explicitly follow the key extracted sections.

Apply the pinned docker-patterns source to [task]. Pay particular attention to these source sections: “Ne Zaman Aktifleştirmeli”, “Yerel Geliştirme için Docker Compose”, “Standart Web Uygulaması Stack'i”, “docker-compose.yml”, “Geliştirme vs Üretim Dockerfile”. Preserve the important decision at each step. Mark facts not covered by the source as “needs confirmation” instead of inventing them. Then verify the result against my acceptance criteria: [criteria].

Result-review prompt

Check omissions, permissions, and source drift before delivery.

Review the current docker-patterns result: (1) does it satisfy the original task; (2) were any applicable steps or limits in the pinned SKILL.md missed; (3) did it perform any unauthorized file, command, network, or data action; and (4) which conclusions remain unverified? List issues first, then fix only what the source or user authorization supports.

Output checklist

Verify each item before delivery

The task matches the purpose documented in the SKILL.md.

The source section “Ne Zaman Aktifleştirmeli” has been checked.

The source section “Yerel Geliştirme için Docker Compose” has been checked.

The source section “Standart Web Uygulaması Stack'i” has been checked.

The source section “docker-compose.yml” has been checked.

Inputs, constraints, and acceptance criteria are explicit.

Unverified facts, compatibility, and outcome claims are clearly marked.

Any file, command, network, or data action has been reviewed.

Choose a different workflow

When another Skill is the better fit

FAQ

What does docker-patterns do?

Konteynerize edilmiş geliştirme için Docker ve Docker Compose en iyi uygulamaları.

How do I start using docker-patterns?

The catalog detected this source-specific install command: npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/docker-patterns". Inspect the command and pinned source before running it.

Which Agent platforms does it declare?

No dedicated Agent platform is declared in the pinned source record.

Repository stars
234,327
Repository forks
35,711
Quality
58/100
Source repository last pushed

Quality breakdown

Based on traceable docs and repository signals; stars are not treated as quality.

58/100
Documentation23/30
Specificity7/25
Maintenance20/20
Trust signals8/25
View original Skill.mdThis page is parsed directly from the repository SKILL.md without editorial rewriting. Collected: Jul 28, 2026 · about 1 min

Docker Kalıpları

Konteynerize edilmiş geliştirme için Docker ve Docker Compose en iyi uygulamaları.

Ne Zaman Aktifleştirmeli

  • Yerel geliştirme için Docker Compose kurarken
  • Çok konteynerli mimariler tasarlarken
  • Konteyner ağ veya volume sorunlarını giderirken
  • Dockerfile'ları güvenlik ve boyut için incelerken
  • Yerel geliştirmeden konteynerize iş akışına geçerken

Yerel Geliştirme için Docker Compose

Standart Web Uygulaması Stack'i

# docker-compose.yml
services:
  app:
    build:
      context: .
      target: dev                     # Multi-stage Dockerfile'ın dev aşamasını kullan
    ports:
      - "3000:3000"
    volumes:
      - .:/app                        # Hot reload için bind mount
      - /app/node_modules             # Anonim volume -- konteyner bağımlılıklarını korur
    environment:
      - DATABASE_URL=postgres://postgres:postgres@db:5432/app_dev
      - REDIS_URL=redis://redis:6379/0
      - NODE_ENV=development
    depends_on:
      db:
        condition: service_healthy
      redis:
        condition: service_started
    command: npm run dev

  db:
    image: postgres:16-alpine
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: app_dev
    volumes:
      - pgdata:/var/lib/postgresql/data
      - ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init.sql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 3s
      retries: 5

  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    volumes:
      - redisdata:/data

  mailpit:                            # Yerel email testi
    image: axllent/mailpit
    ports:
      - "8025:8025"                   # Web UI
      - "1025:1025"                   # SMTP

volumes:
  pgdata:
  redisdata:

Geliştirme vs Üretim Dockerfile

# Aşama: bağımlılıklar
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci

# Aşama: dev (hot reload, debug araçları)
FROM node:22-alpine AS dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
EXPOSE 3000
CMD ["npm", "run", "dev"]

# Aşama: build
FROM node:22-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build && npm prune --production

# Aşama: production (minimal image)
FROM node:22-alpine AS production
WORKDIR /app
RUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001
USER appuser
COPY --from=build --chown=appuser:appgroup /app/dist ./dist
COPY --from=build --chown=appuser:appgroup /app/node_modules ./node_modules
COPY --from=build --chown=appuser:appgroup /app/package.json ./
ENV NODE_ENV=production
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:3000/health || exit 1
CMD ["node", "dist/server.js"]

Override Dosyaları

# docker-compose.override.yml (otomatik yüklenir, sadece dev ayarları)
services:
  app:
    environment:
      - DEBUG=app:*
      - LOG_LEVEL=debug
    ports:
      - "9229:9229"                   # Node.js debugger

# docker-compose.prod.yml (üretim için açıkça)
services:
  app:
    build:
      target: production
    restart: always
    deploy:
      resources:
        limits:
          cpus: "1.0"
          memory: 512M
# Geliştirme (override'ı otomatik yükler)
docker compose up

# Üretim
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Ağ (Networking)

Servis Keşfi

Aynı Compose ağındaki servisler servis adıyla çözümlenir:

# "app" konteynerinden:
postgres://postgres:postgres@db:5432/app_dev    # "db" db konteynerine çözümlenir
redis://redis:6379/0                             # "redis" redis konteynerine çözümlenir

Özel Ağlar

services:
  frontend:
    networks:
      - frontend-net

  api:
    networks:
      - frontend-net
      - backend-net

  db:
    networks:
      - backend-net              # Sadece api'den erişilebilir, frontend'den değil

networks:
  frontend-net:
  backend-net:

Sadece Gereklileri Açığa Çıkarma

services:
  db:
    ports:
      - "127.0.0.1:5432:5432"   # Sadece host'tan erişilebilir, ağdan değil
    # Üretimde port'ları tamamen çıkar -- sadece Docker ağı içinden erişilebilir

Volume Stratejileri

volumes:
  # İsimli volume: konteyner yeniden başlatmalarında kalıcı, Docker tarafından yönetilir
  pgdata:

  # Bind mount: host dizinini konteynere eşler (geliştirme için)
  # - ./src:/app/src

  # Anonim volume: bind mount override'ından konteyner tarafından oluşturulan içeriği korur
  # - /app/node_modules

Yaygın Kalıplar

services:
  app:
    volumes:
      - .:/app                   # Kaynak kodu (hot reload için bind mount)
      - /app/node_modules        # Konteyner'ın node_modules'ünü host'tan koru
      - /app/.next               # Build cache'ini koru

  db:
    volumes:
      - pgdata:/var/lib/postgresql/data          # Kalıcı veri
      - ./scripts/init.sql:/docker-entrypoint-initdb.d/init.sql  # Init scriptleri

Konteyner Güvenliği

Dockerfile Sıkılaştırma

# 1. Belirli tag'ler kullanın (:latest asla)
FROM node:22.12-alpine3.20

# 2. Root olmayan kullanıcı olarak çalıştır
RUN addgroup -g 1001 -S app && adduser -S app -u 1001
USER app

# 3. Capability'leri düşür (compose'da)
# 4. Mümkün olduğunda salt okunur kök dosya sistemi
# 5. Image layer'larında secret yok

Compose Güvenliği

services:
  app:
    security_opt:
      - no-new-privileges:true
    read_only: true
    tmpfs:
      - /tmp
      - /app/.cache
    cap_drop:
      - ALL
    cap_add:
      - NET_BIND_SERVICE          # Sadece < 1024 port'lara bind için

Secret Yönetimi

# İYİ: Ortam değişkenleri kullanın (runtime'da enjekte edilir)
services:
  app:
    env_file:
      - .env                     # .env'i asla git'e commit etmeyin
    environment:
      - API_KEY                  # Host ortamından miras alır

# İYİ: Docker secrets (Swarm modu)
secrets:
  db_password:
    file: ./secrets/db_password.txt

services:
  db:
    secrets:
      - db_password

# KÖTÜ: Image'de hardcode
# ENV API_KEY=sk-proj-xxxxx      # ASLA BUNU YAPMAYIN

.dockerignore

node_modules
.git
.env
.env.*
dist
coverage
*.log
.next
.cache
docker-compose*.yml
Dockerfile*
README.md
tests/

Hata Ayıklama

Yaygın Komutlar

# Logları görüntüle
docker compose logs -f app           # App loglarını takip et
docker compose logs --tail=50 db     # db'den son 50 satır

# Çalışan konteynerde komut çalıştır
docker compose exec app sh           # app'e shell ile gir
docker compose exec db psql -U postgres  # postgres'e bağlan

# İncele
docker compose ps                     # Çalışan servisler
docker compose top                    # Her konteynerdeki işlemler
docker stats                          # Kaynak kullanımı

# Yeniden build et
docker compose up --build             # Image'leri yeniden build et
docker compose build --no-cache app   # Tam rebuild'i zorla

# Temizle
docker compose down                   # Konteynerleri durdur ve kaldır
docker compose down -v                # Volume'leri de kaldır (YIKıCı)
docker system prune                   # Kullanılmayan image/konteynerleri kaldır

Ağ Sorunlarını Hata Ayıklama

# Konteyner içinde DNS çözümlemesini kontrol et
docker compose exec app nslookup db

# Bağlantıyı kontrol et
docker compose exec app wget -qO- http://api:3000/health

# Ağı incele
docker network ls
docker network inspect <project>_default

Anti-Kalıplar

# KÖTÜ: Üretimde orkestrasyon olmadan docker compose kullanma
# Üretim çok konteynerli iş yükleri için Kubernetes, ECS veya Docker Swarm kullanın

# KÖTÜ: Volume olmadan konteynerlerde veri depolama
# Konteynerler geçicidir -- volume olmadan yeniden başlatmada tüm veri kaybolur

# KÖTÜ: Root olarak çalıştırma
# Daima root olmayan bir kullanıcı oluşturun ve kullanın

# KÖTÜ: :latest tag kullanma
# Yeniden üretilebilir build'ler için belirli versiyonlara sabitle

# KÖTÜ: Tüm servisleri içeren tek dev konteyner
# Endişeleri ayırın: konteyner başına bir işlem

# KÖTÜ: Secret'ları docker-compose.yml'e koymak
# .env dosyaları (gitignore'lanmış) veya Docker secrets kullanın
Source repo
affaan-m/ECC
Skill path
docs/tr/skills/docker-patterns/SKILL.md
Commit SHA
4e973d3eaf92
Repository license
MIT
Data collected