Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

cloud-run-source-deploy size always increasing

2025-01-07T19:52:06 2025-01-07T19:52:06 409165933

My docker size is like 500mb but:



It seems to be overwritten with each new version, the size keeps increasing 500mb 500mb.It seems to be overwritten with each new version, the size keeps increasing 500mb 500mb.It seems to be overwritten with each new version, the size keeps increasing 500mb 500mb.It seems to be overwritten with each new version, the size keeps increasing 500mb 500mb.


It seems to be overwritten with each new version, the size keeps increasing 500mb 500mb.

1 1 165
1 REPLY 1

Hi @Mountain,

Welcome to the Google Cloud community!

When you package your app into a container, you might accidentally include files that aren't actually needed when the app runs, like tools used during the build process. This makes the size increase of the container, which slows down loading and costs more to store.

To help reduce the size, create two separate parts: one for building the app and another for creating the final container that only includes the essential files for running the app.

Here's a breakdown of how to optimize Docker images using Google Cloud services:

1. Optimize Dockerfile

  • Minimize Layers: Each instruction in your Dockerfile creates a new layer. Combine multiple RUN commands where possible to reduce the number of layers.
  • Clean Up Intermediate Files: Remove unnecessary files during the build process.
  • Leverage Multi-stage Builds: Create separate build and runtime stages to copy only the essential files into the final image.

2. Choose a Smaller Base Image

3. Regular Cleanup

  • Regularly remove unused images and containers using docker image prune

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

Top Solution Authors