Source profileQuality 58/100Review permissions

affaan-m/ECC/docs/tr/skills/docker-patterns/SKILL.md

docker-patterns

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

Source repository stars
234,327
Declared platforms
0
Static risk flags
2
Last source update
2026-07-27
Source checked
2026-07-28

Decision brief

What it does—and where it fits

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

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/affaan-m/ECC --skill "docs/tr/skills/docker-patterns"
    Safe inspection promptEditorial

    Inspect the Agent Skill "docker-patterns" from https://github.com/affaan-m/ECC/blob/4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38/docs/tr/skills/docker-patterns/SKILL.md at commit 4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Ne Zaman Aktifleştirmeli

      Yerel geliştirme için Docker Compose kurarken

      Yerel geliştirme için Docker Compose kurarkenÇok konteynerli mimariler tasarlarkenKonteyner ağ veya volume sorunlarını giderirken
    2. 02

      Yerel Geliştirme için Docker Compose

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

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

      Standart Web Uygulaması Stack'i

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

      Review and apply the “Standart Web Uygulaması Stack'i” source section.
    4. 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…

      "3000:3000".:/app Hot reload için bind mount/app/nodemodules Anonim volume -- konteyner bağımlılıklarını korur
    5. 05

      Geliştirme vs Üretim Dockerfile

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

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

    Permission review

    Static risk signals and limitations

    Network access

    medium · line 109

    The documentation includes network, browsing, or remote request actions.

    HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:3000/health || exit 1

    Runs scripts

    medium · line 140

    The documentation asks the agent to run terminal commands or scripts.

    docker compose up

    Runs scripts

    medium · line 143

    The documentation asks the agent to run terminal commands or scripts.

    docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d

    Network access

    medium · line 331

    The documentation includes network, browsing, or remote request actions.

    docker compose exec app wget -qO- http://api:3000/health

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score58/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars234,327SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    affaan-m/ECC
    Skill path
    docs/tr/skills/docker-patterns/SKILL.md
    Commit
    4e973d3eaf92d97f8d2e2d8abb39d8bdc8711b38
    License
    MIT
    Collected
    2026-07-28
    Default branch
    main
    View the original SKILL.md

    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
    

    Alternatives

    Compare before choosing