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

API v2: delete an image #6261

Closed
Edward5hen opened this issue May 18, 2020 · 5 comments · Fixed by #6264
Closed

API v2: delete an image #6261

Edward5hen opened this issue May 18, 2020 · 5 comments · Fixed by #6264
Assignees
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@Edward5hen
Copy link
Contributor

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description
As the doc says, /libpod/images/{name:.*}/remove should delete an image with DELETE method. But I get a "no such image" 404 code.

Steps to reproduce the issue:

  1. setup the apiv2 service

  2. podman pull alpine

  3. curl -v -X DELETE http://localhost:8081/v1.40/libpod/images/f70734b6a266/remove

Describe the results you received:

[root@Fedora31 ~]# podman images
REPOSITORY                 TAG      IMAGE ID       CREATED       SIZE
docker.io/library/alpine   latest   f70734b6a266   2 weeks ago   5.88 MB
[root@Fedora31 ~]# curl -v -X DELETE http://localhost:8081/v1.40/libpod/images/f70734b6a266/remove
*   Trying ::1:8081...
* TCP_NODELAY set
* connect to ::1 port 8081 failed: Connection refused
*   Trying 127.0.0.1:8081...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8081 (#0)
> DELETE /v1.40/libpod/images/f70734b6a266/remove HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.66.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Type: application/json
< Date: Thu, 14 May 2020 05:12:53 GMT
< Content-Length: 182
<
{"cause":"no such image","message":"Failed to find image f70734b6a266/remove: unable to find a name and tag match for f70734b6a266/remove in repotags: no such image","response":404}
* Connection #0 to host localhost left intact

Describe the results you expected:
Remove the image successfully

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

[root@Fedora31 ~]# podman version
Version:            1.9.1
RemoteAPI Version:  1
Go Version:         go1.13.9
Built:              Mon May 11 06:37:25 2020
OS/Arch:            linux/amd64

Output of podman info --debug:

[root@Fedora31 ~]# podman info --debug
debug:
  compiler: gc
  gitCommit: ""
  goVersion: go1.13.9
  podmanVersion: 1.9.1
host:
  arch: amd64
  buildahVersion: 1.14.8
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.15-1.fc31.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.15, commit: 4152e6044da92e0c5f246e5adf14c85f41443759'
  cpus: 2
  distribution:
    distribution: fedora
    version: "31"
  eventLogger: file
  hostname: Fedora31
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.3.7-301.fc31.x86_64
  memFree: 768737280
  memTotal: 2077401088
  ociRuntime:
    name: crun
    package: crun-0.13-2.fc31.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.13
      commit: e79e4de4ac16da0ce48777afb72c6241de870525
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  rootless: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 2204889088
  swapTotal: 2214588416
  uptime: 145h 26m 36.64s (Approximately 6.04 days)
registries:
  search:
  - docker.io
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - quay.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 1
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes

Additional environment details (AWS, VirtualBox, physical, etc.):
KVM vm

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label May 18, 2020
@mheon
Copy link
Member

mheon commented May 18, 2020

@baude PTAL

@baude
Copy link
Member

baude commented May 18, 2020

@Edward5hen i can understand this one is a little confusing because we expose both a single and "batch" removal for images.

http://docs.podman.io/en/latest/_static/api.html#operation/libpodRemoveImage is the standard endpoint which removes one image only and the name is in the path of the endpoint. For example, images/foobar ... note there is no remove endpoint, instead the method of DELETE tells the endpoint to remove the image.

http://docs.podman.io/en/latest/_static/api.html#operation/libpodImagesRemove is meant for batch removal of images and is a function on "images". So in that case, it is libpod/images/remove and the names of the images to be removed are passed as a query parameter in type array.

@baude baude added bug and removed kind/bug Categorizes issue or PR as related to a bug. labels May 18, 2020
@baude
Copy link
Member

baude commented May 18, 2020

actually, there is a bug ... the single endpoint should NOT have a trailing /remove. Fixing now...

@baude
Copy link
Member

baude commented May 18, 2020

@Edward5hen thanks for the report!

baude added a commit to baude/podman that referenced this issue May 18, 2020
the endpoint for single image removal (on the libpod side) should be as follows:

versionedPath/libpod/images/IMAGENAME

The DELETE method then signifies the removal of the image.

Fixes: containers#6261

Signed-off-by: Brent Baude <[email protected]>
@Edward5hen
Copy link
Contributor Author

@baude it's really my pleasure. The fix is so quick!

snj33v pushed a commit to snj33v/libpod that referenced this issue May 31, 2020
the endpoint for single image removal (on the libpod side) should be as follows:

versionedPath/libpod/images/IMAGENAME

The DELETE method then signifies the removal of the image.

Fixes: containers#6261

Signed-off-by: Brent Baude <[email protected]>
@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 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants