Tech TutorBangla Web Documentation
Portfolio
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • Docker Documentation25টি অধ্যায়
প্রযুক্তি নির্বাচন
HomeHTMLCSSTailwind CSSJavaScriptTypeScriptReactNext.jsNode.jsExpressSocket.IOExpoWordPressPostgreSQLPrismaPostgresNestJSMongoDBDockerTanStackTanStack TableRTK QueryGitGitHub
  • Introduction
  • Containerization
  • Architecture
  • Installation
  • Images
  • Containers
  • Dockerfile
  • Volumes
  • Networks
  • Docker Compose
  • Environment Variables
  • Node.js + Docker
  • Next.js + Docker
  • Express.js + Docker
  • NestJS + Docker
  • Databases + Docker
  • Development Workflow
  • Production
  • Multi-stage Builds
  • Security
  • Optimization
  • CI/CD
  • Deployment
  • Real-world Project
  • Interview Questions
  1. Docs
  2. Docker
  3. Production-এর জন্য Docker
DockerAdvanced

Production-এর জন্য Docker

Restart policy, healthcheck, logging, resource limits ও হালকা production image — বাংলায়।

14টি অংশবাংলা ভাষায়

প্রোডাকশন মানে — container-কে বিশ্বস্ত, আত্মসচেতন ও নিরাপদ রাখা। মিলল কয়েকটি essentials:

Restart policy

compose.ymlyaml
yaml
services:
  api:
    image: my-api
    restart: unless-stopped    # crash হলে auto-restart
Policyআচরণ
noকিছুই না (default)
alwaysযেকোনো অবস্থায় restart
unless-stoppedmanually stop করা ছাড়া restart
on-failure:5কথা ঠিকেই failure-এর পর restart (max 5)

Healthcheck

compose.ymlyaml
yaml
services:
  api:
    build: .
    healthcheck:
      test: ["CMD", "node", "-e", "fetch('http://localhost:3000/health').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s

Resource limits

Limit CPU/Memoryyaml
yaml
services:
  api:
    image: my-api
    deploy:
      resources:
        limits:
          cpus: "0.5"      # সর্বোচ্চ ৫০% CPU
          memory: 512M     # সর্বোচ্চ 512 MB
        reservations:
          memory: 128M

Logging

Default JSON logger-কে stdout-এ লিখুন। Docker সেই logs collector-এ নিয়ে যায় — docker logs, or cloud logging service (যেমন loki, cloudwatch)।

Rotate ও limityaml
yaml
services:
  api:
    image: my-api
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

Production checklist

  • Multi-stage build + হালকা base image
  • Non-root user (USER node)
  • NODE_ENV=production set
  • Restart policy + healthcheck
  • Secrets env-তে, না image-এ
  • .dockerignore দিয়ে image ছোট করা
  • docker compose config দিয়ে file validate
  • docker scout / trivy দিয়ে vulnerability scan
compose config

docker compose config কমান্ড file validate ও resolved output দেখায় — deploy-এর আগে চালিয়ে নিন; করে syntax/আরো অন্য ভুল ধরা পড়বে।

শেষ প্যারায় নিজে practice করুন — কোড কপি করে নিজের এডিটরে চালিয়ে দেখুন।
আগেরDocker দিয়ে Development WorkflowপরেরMulti-stage Builds
এই পেজে
Tech Tutor

বাংলায় ওয়েব ডেভেলপমেন্ট ডকুমেন্টেশন শিখুন — ধাপে ধাপে।

Homeসব ডকুমেন্টেশনQuick Startআমার নোটস

© 2026 Tech Tutor. বাংলায় শিখুন, বাংলায় গড়ুন।

mdanamolhasan1998@gmail.com