Use Small Base Images
DK · Best Practicessyntax
FROM <image>:<version>-alpine
FROM <image>:<version>-slimexample
# Instead of:
FROM node:20 # ~1GB
# Use:
FROM node:20-alpine # ~130MB
FROM python:3.12-slim # ~150MB vs 900MB for fullNote Alpine images use musl libc instead of glibc, which can cause issues with some native Node.js modules or Python C extensions. Test thoroughly. Debian slim is a safer middle ground if Alpine causes problems.