GoogleContainerTools / GoogleContainerTools/skaffold

Pruning not working when custom base image is used

Open
#5,260 1 comment 0 reactions 0 assignees View on GitHub
area/prune fixit kind/bug priority/p3
Dominant language
Go
Stars
15.9k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

I have a Dockerfile that uses a custom base image. The custom base image used is based on another custom base image.
That is there are three locally built images with the following dependency: final_image <- custom_image2 <- custom_image1 <- docker_base_image

Everything builds and deploys properly, but during pruning it fails to prune the custom base images, but it prunes the final ones.

### Expected behavior
Prune all images including custom base images.

### Actual behavior
Fails to prune custom base images with error message:

> Pruning images...
> WARN[1116] builder cleanup: pruning images: could not remove image "sha256:....." after 5 retries

### Information

Skaffold version: v1.16.0
Operating system: MacOS
Contents of skaffold.yaml:

```yaml
apiVersion: skaffold/v2beta9
kind: Config
metadata:
name: test
build:
tagPolicy:
sha256: {}
artifacts:
- image: common_base
context: ./pp
docker:
dockerfile: ./ss/cc.Dockerfile
buildArgs:
PROXY: '{{ .PROXY }}'
- image: next_base
requires:
- image: common_base
alias: COMMON_BASE
context: ./pp
docker:
dockerfile: ./ss/1/dd.Dockerfile
- image: final
requires:
- image: next_base
alias: NEXT_BASE
context: ./pp
docker:
dockerfile: ./ss/1/Dockerfile
deploy:
kubeContext: docker-desktop
kubectl:
manifests:
- final.yaml
defaultNamespace: dev
portForward:
- resourceType: deployment
resourceName: final
namespace: dev
port: 2000
localPort: 1000
```

Dockerfiles import base images via ARG and FROM

### Steps to reproduce the behavior

`PRR=local skaffold dev --trigger=manual --cleanup=true -v info --port-forward --cache-artifacts=false --no-prune=false`

PS: also it seems like .dockerignore files are not taken into account but that is a different issue

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.