GoogleCloudPlatform / cloud-code-vscode

Cloud Code for Visual Studio Code: Issues, Documentation and more
Other
416 stars 111 forks source link

[Feature Request] Automatically prune container images from previous builds #534

Open stephennancekivell opened 2 years ago

stephennancekivell commented 2 years ago

Environment: Macbook Pro M1

Version information

Cloud Code Extension version: v1.17.0

VSCode version: 1.64.2

OS: mac

Cloud SDK:

Skaffold:

Kubectl:

Description: Hi, thanks for the project 😊 I have a small go project which we develop with cloud-run. Its built as a distroless image. After a few days of usage, I get this error. It seems like cloud-code isn't cleaning itself up.

image

I can login to the cloud-run-dev-internal container and run docker system prune to clear it out.

➜  ~ docker ps
CONTAINER ID   IMAGE                                 COMMAND                  CREATED       STATUS       PORTS                                                                                                                                  NAMES
b7144ee24f99   gcr.io/k8s-minikube/kicbase:v0.0.28   "/usr/local/bin/entr…"   11 days ago   Up 2 hours   127.0.0.1:56715->22/tcp, 127.0.0.1:56716->2376/tcp, 127.0.0.1:56712->5000/tcp, 127.0.0.1:56714->8443/tcp, 127.0.0.1:56710->32443/tcp   cloud-run-dev-internal
➜  ~ docker exec -it b7144ee24f99 bash
root@cloud-run-dev-internal:/# docker ps -a | grep Exited | wc -l
188

➜  ~ docker system prune  
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

Are you sure you want to continue? [y/N] y   
Deleted Containers:
139e174182e2292bd9c74737c4dfbc5ad1fe9bd0c5d7f291a75c49ebaabcb7ab
498a8eb7ef626a7156a9fcc9a6fc00786a82037009f1f2b7344422e5c0584b0d
-- snip ---
deleted: sha256:abec775d1a391498dd0a0a5a748ff230968ca8f450938560f5c76e34116c824c

Total reclaimed space: 50.44GB

After that I can redeploy and it works. It would be nice if cloud-code automatically deleted the temporary images.

Repro step:

Use cloud-run in vscode. Save and rebuild every few minutes.

glouischandra commented 2 years ago

Hello @stephennancekivell sorry for the late reply, I'm still investigating this feature request. Will get back to you soon!

ssmall commented 2 years ago

Marked this as a feature request, thanks for raising this!