A worked example, rendered from real sample data. Sign in to run the tool on your own input.
FROM ubuntu:latest
RUN apt-get update && apt-get install -y curl
RUN apt-get install -y git
COPY . /app
CMD ["npm", "start"]{
"layerCount": 0,
"issues": [
"Line 1: Use specific version tag instead of 'latest'",
"Line 3: Use --no-install-recommends to reduce layer size"
],
"suggestions": [
"Combine RUN commands with && to reduce layers",
"Use multi-stage builds to minimize final image",
"Sort commands by frequency of change"
],
"estimatedSize": "~150MB",
"optimized": {
"example": "FROM node:20-alpine\nRUN apk add --no-cache python3\nWORKDIR /app\nCOPY package*.json ./\nRUN npm ci --only=production\nCOPY . .\nEXPOSE 3000\nCMD [\"node\", \"server.js\"]"
}
}
Analyze and optimize Dockerfiles for size, speed, and best practices. Part of the DevTools Surf developer suite. Browse more tools in the Developer Utilities collection.