DEV Community

saqib abbas
saqib abbas

Posted on

Struggling with Docker Build Times? Here’s a Quick Tip 🐳

Struggling with Docker Build Times? Here’s a Quick Tip 🐳

Hey devs! 👋

Recently, I faced super slow Docker build times on a project. After digging around, I realized the issue was with unnecessary files being copied into the image. The solution? Adding a proper .dockerignore file!

Here’s what worked:

Create a .dockerignore file in your project root.
Add entries like node_modules/, .git/, or any large, irrelevant files.
Rebuild the image, and voilà—faster builds! 🚀
Hope this helps someone save time! What’s your favorite Docker hack? Share below! 👇

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more