Skip to content

"docker inspect" can't reach the image JSON when there is a same name container running. #12483

@shishir-a412ed

Description

@shishir-a412ed

Description of problem:
When there is a image named, for instance "rhel7" and a container is also has the same name, then "docker inspect rhel7" only shows containers json, the command can't reach the image's scope.

Version-Release number of selected component (if applicable):
docker-1.6.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.

docker images

REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
registry.access.redhat.com/rhel7 latest 10acc31def5d 10 weeks ago 154.1 MB

docker run --name rhel7 rhel7 /bin/bash

docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d4ac50753fe4 rhel7:latest "/bin/bash" 2 hours ago Exited (0) 2 hours ago rhel7

docker inspect rhel7

Debug log:(reach the container, then return)
DEBU[0026] Calling GET /containers/json
INFO[0026] GET /v1.18/containers/json?all=1
INFO[0026] +job containers()
INFO[0026] -job containers() = OK (0)
DEBU[0064] Calling GET /containers/{name:.*}/json
INFO[0064] GET /v1.18/containers/rhel7/json
INFO[0064] +job container_inspect(rhel7)
INFO[0064] -job container_inspect(rhel7) = OK (0)

Otherwise, after delete the container,
(fail to find the container then continue to reach the image and return

DEBU[0106] Calling GET /containers/{name:.}/json
INFO[0106] GET /v1.18/containers/rhel7/json
INFO[0106] +job container_inspect(rhel7)
no such id: rhel7
INFO[0106] -job container_inspect(rhel7) = ERR (1)
ERRO[0106] Handler for GET /containers/{name:.
}/json returned error: no such id: rhel7
ERRO[0106] HTTP Error: statusCode=404 no such id: rhel7
DEBU[0106] Calling GET /images/{name:.*}/json
INFO[0106] GET /v1.18/images/rhel7/json
INFO[0106] +job image_inspect(rhel7)
INFO[0106] -job image_inspect(rhel7) = OK (0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions