Skaffold works with image builders and deployers that both have side effects on both your local and deployment environments:

  • resources are created in one or more namespaces in a Kubernetes cluster
  • images might be created on the local Docker daemon
  • images might be pushed to registries
  • application might have arbitrary side effects

Skaffold offers cleanup functionality to negate some of these side effects:

  • Kubernetes resource cleanup - skaffold delete, and automatic cleanup on Ctrl+C for skaffold dev and skaffold debug
  • Image pruning - for local Docker daemon images only, automatically on Ctrl+C for skaffold dev and skaffold debug

For pushed images in registries and application side effects the user has to take care of cleanup.

Kubernetes resource cleanup

After running skaffold run or skaffold deploy and deploying your application to a cluster, running skaffold delete will remove all the resources you deployed. Cleanup is enabled by default, it can be turned off by --cleanup=false.

Ctrl + C

When running skaffold dev or skaffold debug, pressing Ctrl+C (SIGINT signal) will kick off the cleanup process which will mimic the behavior of skaffold delete. If for some reason the Skaffold process was unable to catch the SIGINT signal, skaffold delete can always be run later to clean up the deployed Kubernetes resources.

Image pruning

Images that are built by Skaffold and stored on the local Docker daemon can easily pile up, taking up a significant amount of disk space. To avoid this, users can turn on image pruning that deletes the images built by Skaffold on SIGTERM from skaffold dev and skaffold debug.

To enable image pruning, you can run Skaffold with both --no-prune=false and --cache-artifacts=false:

skaffold dev --no-prune=false --cache-artifacts=false


Listing files to watch...
Generating tags...
 - ->
Building []...
Sending build context to Docker daemon  3.072kB
Step 1/6 : FROM golang:1.12.9-alpine3.10 as builder
 ---> e0d646523991
Step 2/6 : COPY main.go .
 ---> Using cache
 ---> 964ce43c7a63
Step 3/6 : RUN go build -o /app main.go
 ---> Using cache
 ---> 1fece4643da6
Step 4/6 : FROM alpine:3.10
 ---> 961769676411
Step 5/6 : CMD ["./app"]
 ---> Using cache
 ---> 256b146875d2
Step 6/6 : COPY --from=builder /app .
 ---> Using cache
 ---> f7a2f5c3a2f6
Successfully built f7a2f5c3a2f6
Successfully tagged
Tags used in deployment:
 - ->
Starting deploy...
 - pod/getting-started created
Watching for changes...
[getting-started] Hello world!
[getting-started] Hello world!
[getting-started] Hello world!

And after hitting Ctrl+C:

^CCleaning up...
 - pod "getting-started" deleted
Pruning images...
untagged image
untagged image
untagged image
deleted image sha256:f7a2f5c3a2f6721989598d09a09ad70134936db398d93303ebb3545de2d32e22
deleted image sha256:c069434a51c8d96f68a95c13bbccd3512849f9ccfe5defbb80af7e342a48bbba

Last modified September 2, 2020: Release v1.14.0 (#4756) (4b3ca59)