skaffold: Skaffold doesn't clean up docker images and containers, even after skaffold delete

Docker images and containers aren’t cleaned up, even after skaffold delete.

Expected behavior

Docker images and containers are always cleaned up

Actual behavior

Docker images and containers remain, creating clutter and wasting disk space.

Information

  • Skaffold version: 1.0.1
  • Operating system: WSL/Ubuntu
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1
kind: Config
build:
  artifacts:
  - image: wpwoodjr/skaffold-example
deploy:
  kubectl:
    manifests:
      - k8s-*

Steps to reproduce the behavior

  1. a clonable repository with the sample skaffold project
  2. skaffold dev
$ skaffold delete
Cleaning up...
$ docker images
REPOSITORY                                   TAG                         IMAGE ID            CREATED              SIZE
wpwoodjr/skaffold-example                    v1.0.0-99-g76329282-dirty   f114e803c18e        About a minute ago   7.55MB
<none>                                       <none>                      b194da296faa        About a minute ago   352MB
<none>                                       <none>                      3becf4eba644        About a minute ago   352MB
wpwoodjr/skaffold-example                    <none>                      7d3f4d732d94        About a minute ago   7.55MB
wpwoodjr/skaffold-example                    <none>                      bd97e61581b3        3 minutes ago        7.55MB
<none>                                       <none>                      00d2083cdc3a        3 minutes ago        352MB
$ docker container ls --all
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS                          PORTS               NAMES
ab871d1c9543        006db2142190        "/bin/sh -c 'go buil…"   About a minute ago   Exited (0) About a minute ago                       sleepy_heisenberg
8817f86b2057        9bf3f697f21d        "/bin/sh -c 'go buil…"   2 minutes ago        Exited (0) About a minute ago                       silly_tu
0be4dbd317b7        965ea09ff2eb        "/bin/sh -c '#(nop) …"   3 minutes ago        Created                                             sharp_mayer
af261bb76430        35640187355a        "/bin/sh -c 'go buil…"   3 minutes ago        Exited (0) 3 minutes ago                            stupefied_cartwright

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 18 (10 by maintainers)

Most upvoted comments

Even with:

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

I still see this image left by Skaffold:

$ docker images
REPOSITORY                                   TAG                   IMAGE ID            CREATED             SIZE
<none>                                       <none>                e88252ff92cb        30 seconds ago      352MB

Also, if there is any kind of error, will cleanup still happen? For instance if Skaffold fails to login to the registry? It’s my opinion that image/container cleanup should happen by default when Skaffold rebuilds something. For the most part, what good are the older containers and images? Also, no-prune=false? Why not prune=true? And why the need for the pruning flags and also a cache-artifacts flag?

Sorry for all the questions but I find this to be very confusing and not intuitive.

@michaelbeaumont i am going to close this as dupe of #4058. Can we move the discussion there?

Sure!

@michielswaanen I think you’re meant here.

Thanks 😉

Not sure #4058 is the same issue, I reported this one as an issue under WSL, #4058 seems to be about bash shell. @michaelbeaumont @tejal29