Urgent.News

What's breaking now, across thousands of outlets.

Tech

Dockerfile CMD Explained: Build-Time vs Runtime and How CMD Override Works

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-এর মধ্যে চলে যাবে। কিন্তু…

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.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

pdf-lib is silently deleting characters from your users' data

I generate invoices in a Node serverless function with pdf-lib . It is a good library. It also quietly destroyed a client's company name, threw nothing, logged nothing, and produced a PDF that opened…

  • pdf-lib library silently deletes characters from user data in PDF documents
  • Issue occurs with non-Latin-1 characters outside 1990s WinAnsi encoding
  • Developers should use TrueType/OpenType fonts to prevent silent data loss

More from Sunday 30 August →