All articlesContainers

Docker for Beginners

May 20, 2025 1 min read

Images vs containers

An image is an immutable template. A container is a running instance of that image.

Your first Dockerfile

FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]

Build and run:

docker build -t myapp .
docker run -p 3000:3000 myapp

Tips

Use small base images, leverage layer caching, and keep secrets out of the image.

#Docker#Containers

Suggested articles