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.