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

docker inspect <image> returning wrong information (docker v1.8.3) #17780

Closed
pommetjehorlepiep opened this issue Nov 7, 2015 · 4 comments
Closed

Comments

@pommetjehorlepiep
Copy link

Description of problem:
I noticed when doing a docker inspect on a Docker Image that the "Image" information returned is incorrect. Although docker images shows a Repository (test) and Tag (1), docker inspect returns "" for "Image"

When image has a Parent, the "Image" field shows the Repository/Tag of the Parent image.

docker version:
Client:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 05:27:08 UTC 2015
OS/Arch: linux/amd64

Server:
Version: 1.8.3
API version: 1.20
Go version: go1.4.2
Git commit: f4bf5c7
Built: Mon Oct 12 05:27:08 UTC 2015
OS/Arch: linux/amd64

docker info:
Containers: 25
Images: 92
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 142
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
CPUs: 4
Total Memory: 15.7 GiB
Name: raven
ID: 32ES:J7WZ:HDAY:OUQH:HGNW:XTPM:ERLW:L3U6:B6RE:KOP2:LGST:7XDH

uname -a:

Linux raven 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u5 (2015-10-09) x86_64 GNU/Linux

Environment details (AWS, VirtualBox, physical, etc.):
physical

How reproducible:
Just run docker inspect on a Docker image which has a Repository & Tag set.

Steps to Reproduce:

  1. Just run docker inspect on a Docker image which has a Repository & Tag set.

Actual Results:
For following image I expect "Image" to return "test:1" instead of just ""...:

docker images | grep d8ec
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
test 1 db8ec01b1f1db About an hour ago 167.5 MB

docker inspect db8ec01b1f1db
[

{
    "Id": "d8ec01b1f1dbb6442bfa4206c951ccb3614f2135eb66b3305e802d7d9486234b",
    "Parent": "",
    "Comment": "Imported from -",
    "Created": "2015-11-07T01:29:22.550951754Z",
    "Container": "",
    "ContainerConfig": {
        "Hostname": "",
        "Domainname": "",
        "User": "",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "Tty": false,
        "OpenStdin": false,
        "StdinOnce": false,
        "Env": null,
        "Cmd": null,
        **"Image": ""**,
        "Volumes": null,
        "WorkingDir": "",
        "Entrypoint": null,
        "OnBuild": null,
        "Labels": null
    },
    "DockerVersion": "1.8.3",
    "Author": "",
    "Config": {
        "Hostname": "",
        "Domainname": "",
        "User": "",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "Tty": false,
        "OpenStdin": false,
        "StdinOnce": false,
        "Env": null,
        "Cmd": null,
        "Image": "",
        "Volumes": null,
        "WorkingDir": "",
        "Entrypoint": null,
        "OnBuild": null,
        "Labels": null
    },
    "Architecture": "amd64",
    "Os": "linux",
    "Size": 167510717,
    "VirtualSize": 167510717,
    "GraphDriver": {
        "Name": "aufs",
        "Data": null
    }
}

Expected Results:
"Image", "test:1" instead of "Image", ""

Additional info:
It seems that if image has a Parent, the "Image" field actually displays the Repository/Tag info or the Parent Image...

@phemmer
Copy link
Contributor

phemmer commented Nov 7, 2015

This is expected behavior.
The ContainerConfig of an image is the container the image was generated from. In the case of your image, it wasn't generated from a container, but from running docker import.

@pommetjehorlepiep
Copy link
Author

OK....so take a look at this then...

I ran test:1 and did a docker commit creating image with repo:tag test2:
ContainerConfig.Image is then correctly saying "test:1".
But what about Config.Image?? Isn't that in this case supposed to show "test:2"?
Or do I got it all wrong here?

docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
test 2 236d97cf0087 4 seconds ago 167.5 MB
test 1 d8ec01b1f1db 3 hours ago 167.5 MB

docker inspect 236d97cf0087
[

{
    "Id": "236d97cf008708800a1245b9b8731515a20b35ebbe4986a35f8d9f2d445aba39",
    "Parent": "d8ec01b1f1dbb6442bfa4206c951ccb3614f2135eb66b3305e802d7d9486234b",
    "Comment": "",
    "Created": "2015-11-07T05:28:52.184635318Z",
    "Container": "0f4db38481e9341a1b80e4bef3b35d6284d53daa1485358de27f68e6163bb131",
    "ContainerConfig": {
        "Hostname": "0f4db38481e9",
        "Domainname": "",
        "User": "",
        "AttachStdin": true,
        "AttachStdout": true,
        "AttachStderr": true,
        "Tty": true,
        "OpenStdin": true,
        "StdinOnce": true,
        "Env": null,
        "Cmd": [
            "/bin/bash"
        ],
        "Image": "test:1",
        "Volumes": null,
        "WorkingDir": "",
        "Entrypoint": null,
        "OnBuild": null,
        "Labels": {}
    },
    "DockerVersion": "1.8.3",
    "Author": "",
    "Config": {
        "Hostname": "",
        "Domainname": "",
        "User": "",
        "AttachStdin": false,
        "AttachStdout": false,
        "AttachStderr": false,
        "Tty": false,
        "OpenStdin": false,
        "StdinOnce": false,
        "Env": null,
        "Cmd": [
            "/bin/bash"
        ],
        "Image": "",
        "Volumes": null,
        "WorkingDir": "",
        "Entrypoint": null,
        "OnBuild": null,
        "Labels": null
    },
    "Architecture": "amd64",
    "Os": "linux",
    "Size": 532,
    "VirtualSize": 167511249,
    "GraphDriver": {
        "Name": "aufs",
        "Data": null
    }
}
]

@pommetjehorlepiep
Copy link
Author

Or is the Config section only populated for containers and not for images?

@thaJeztah
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants