{
  "id": 4381937,
  "title": "Dockerfile CMD Explained: Build-Time vs Runtime and How CMD Override Works",
  "url": "https://urgent.news/2026/08/30/dockerfile-cmd-explained-build-time-vs-runtime-and-how-cmd-override",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-30T08:37:10.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/ragibcs/dockerfile-cmd-explained-build-time-vs-runtime-and-how-cmd-override-works-l4h"
  },
  "original_language": "en",
  "account": "Dockerfile CMD instruction is crucial in determining the default runtime command for a container. When you build an image using Dockerfile, the CMD instruction is not executed during the build process. Instead, it serves as a default command for the container when it is started. In the given example, the CMD command is [ go, run, server.go ], which means that when the container is launched using `docker run`, the Go server will automatically start running on port 8080.",
  "summary": "Dockerfile শেখার সময় FROM , RUN , WORKDIR , এবং COPY নিয়ে কাজ করার পর খুব স্বাভাবিকভাবেই একটি প্রশ্ন আসে: Container start হলে application automatically কীভাবে run করবে? আমরা যদি শুধু এই ধরনের Dockerfile লিখি— FROM ubuntu:24.04 RUN apt update RUN apt install -y golang WORKDIR /app COPY ./server.go ./server.go তাহলে image তৈরি হবে ঠিকই। Go-ও install হবে। server.go -ও image-এর মধ্যে চলে যাবে। কিন্তু…",
  "key_points": [
    "CMD instruction determines default runtime command for container",
    "Executed during container start, not during build process",
    "In example, Go server runs on port 8080 when launched"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}