Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: podman prune images by default should only delete dangling images #2192

Closed
dustymabe opened this issue Jan 20, 2019 · 10 comments
Closed
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@dustymabe
Copy link
Contributor

/kind bug

Description

possibly a variant of #1154. podman image prune seems to remove all images, not just unnamed images.

[vagrant@vanilla-f29-atomic-testing foo]$ echo "foo" > file
[vagrant@vanilla-f29-atomic-testing foo]$ 
[vagrant@vanilla-f29-atomic-testing foo]$ cat Dockerfile 
FROM registry.fedoraproject.org/fedora:29
COPY file /file
[vagrant@vanilla-f29-atomic-testing foo]$ sudo podman build -t foo .
STEP 1: FROM registry.fedoraproject.org/fedora:29
STEP 2: COPY file /file
--> 30dac0f34c014ff719aec51c05423f6dec000785a912e312c1fe4d3d36a31d04
STEP 3: COMMIT foo
--> 4b9cdb6bdd985c60619342c3b2eccf51bf000454ff73133d6fd0989d3994e5b1
[vagrant@vanilla-f29-atomic-testing foo]$ 
[vagrant@vanilla-f29-atomic-testing foo]$ sudo podman images
REPOSITORY                          TAG      IMAGE ID       CREATED         SIZE
localhost/foo                       latest   4b9cdb6bdd98   9 seconds ago   283 MB
<none>                              <none>   30dac0f34c01   9 seconds ago   283 MB
registry.fedoraproject.org/fedora   29       69c5db8b64a7   11 days ago     283 MB
registry.fedoraproject.org/fedora   28       ded494ce3076   3 months ago    264 MB
[vagrant@vanilla-f29-atomic-testing foo]$ 
[vagrant@vanilla-f29-atomic-testing foo]$ sudo podman image prune
69c5db8b64a76b5f0b3ac812f317f828d3d4d8e7b399ea196de6de659c225b96
ded494ce3076e8f2d264235fdb09da5970921d8317f8fd024ab65821bf13e29f
30dac0f34c014ff719aec51c05423f6dec000785a912e312c1fe4d3d36a31d04
4b9cdb6bdd985c60619342c3b2eccf51bf000454ff73133d6fd0989d3994e5b1
[vagrant@vanilla-f29-atomic-testing foo]$ 
[vagrant@vanilla-f29-atomic-testing foo]$ sudo podman images
[vagrant@vanilla-f29-atomic-testing foo]$ 

podman version/info

[vagrant@vanilla-f29-atomic-testing foo]$ rpm -q podman
podman-1.0.0-1.git82e8011.fc29.x86_64
[vagrant@vanilla-f29-atomic-testing foo]$
[vagrant@vanilla-f29-atomic-testing foo]$ sudo podman version
Version:       1.0.0
Go Version:    go1.11.4
Git Commit:    "49780a1cf10d572edc4e1ea3b8a8429ce391d47d"
Built:         Mon Jan 14 20:38:17 2019
OS/Arch:       linux/amd64
[vagrant@vanilla-f29-atomic-testing foo]$ sudo podman info 
host:
  BuildahVersion: 1.6-dev
  Conmon:
    package: podman-1.0.0-1.git82e8011.fc29.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.12.0-dev, commit: 49780a1cf10d572edc4e1ea3b8a8429ce391d47d'
  Distribution:
    distribution: fedora
    version: "29"
  MemFree: 3407650816
  MemTotal: 4133462016
  OCIRuntime:
    package: runc-1.0.0-67.dev.git12f6a99.fc29.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc6+dev
      commit: d164d9b08bf7fc96a931403507dd16bced11b865
      spec: 1.0.1-dev
  SwapFree: 0
  SwapTotal: 0
  arch: amd64
  cpus: 4
  hostname: vanilla-f29-atomic-testing
  kernel: 4.20.3-200.fc29.x86_64
  os: linux
  rootless: false
  uptime: 1h 7m 23.14s (Approximately 0.04 days)
insecure registries:
  registries: []
registries:
  registries:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 0
  GraphDriverName: overlay
  GraphOptions: null
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
  ImageStore:
    number: 0
  RunRoot: /var/run/containers/storage

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 20, 2019
@rhatdan
Copy link
Member

rhatdan commented Jan 21, 2019

@baude Could you look at this?

@mheon
Copy link
Member

mheon commented Jan 21, 2019

I think this might be intended behavior? podman image prune says it removes all images not being used by containers.

Maybe this should be gated by a flag, separate from "remove leftover intermediate images"?

@dustymabe
Copy link
Contributor Author

I think this might be intended behavior? podman image prune says it removes all images not being used by containers.

That is not my interpretation of the help text:

[dustymabe@hattop ~]$ podman image prune --help
NAME:
   podman image prune - Remove unused images

USAGE:
   podman image prune [arguments...]

DESCRIPTION:
   
  podman image prune

  Removes all unnamed images from local storage

To me Removes all unnamed images from local storage would only touch images that don't have a label.

@TomSweeneyRedHat
Copy link
Member

FWIW, my thinking was prune should be removing any images with a tag and leaving the rest alone.

@TomSweeneyRedHat
Copy link
Member

Ugh, love md4 sometimes in GitHub. "images with a tag" s/b "images with a <none><none> tag"

@baude
Copy link
Member

baude commented Jan 21, 2019

Nope, to be compatible with docker, prune removes all unused images (images that are not being used by a container). the atomic cli prune command was just the none images. the help text is incorrect and should be updated. you can see in the short description, it says unused.

baude added a commit to baude/podman that referenced this issue Jan 21, 2019
Correct the help text for the image prune command to state that it
removes all unused images.

Issue: containers#2192

Signed-off-by: baude <bbaude@redhat.com>
@dustymabe
Copy link
Contributor Author

atomic cli prune command was just the none images

how do we get that functionality ^^ - that's what I'm interested in

@baude
Copy link
Member

baude commented Jan 21, 2019

what do you want the command line switch to be? it should probably be somethign like --only-something-or-another

@baude baude added enhancement and removed kind/bug Categorizes issue or PR as related to a bug. labels Jan 21, 2019
@baude baude changed the title podman image prune seems to delete all images RFC: podman prune images needs a switch to delete only none images Jan 21, 2019
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 21, 2019
@TomSweeneyRedHat
Copy link
Member

Hmmm,

I'm looking at: https://docs.docker.com/engine/reference/commandline/image_prune/

and it says:

Extended description

Remove all dangling images. If -a is specified, will also remove all images not referenced by any container.

Where danglng errors have the <none> tag. Where did you find your prune info or am I misreading this doc?

@baude
Copy link
Member

baude commented Jan 22, 2019

fine thats seems to be what we should do.

@baude baude changed the title RFC: podman prune images needs a switch to delete only none images RFC: podman prune images by default should only delete dangling images Jan 22, 2019
baude added a commit to baude/podman that referenced this issue Jan 29, 2019
we now, by default, only prune dangling images.  if --all is passed, we
prune dangling images AND images that do not have an associated containers.

also went ahead and enabled the podman-remote image prune side of things.

Fixes: containers#2192

Signed-off-by: baude <bbaude@redhat.com>
mheon pushed a commit to mheon/libpod that referenced this issue Feb 8, 2019
we now, by default, only prune dangling images.  if --all is passed, we
prune dangling images AND images that do not have an associated containers.

also went ahead and enabled the podman-remote image prune side of things.

Fixes: containers#2192

Signed-off-by: baude <bbaude@redhat.com>

MH: Removed dependence on remote-client adapter work to limit scale of changes

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

6 participants