-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Return image ID from docker image load command #2212
Comments
This requires a change in the API code to return the information. Looks like the API currently returns either;
imageIDsStr += fmt.Sprintf("Loaded image ID: %s\n", imgID) if imageRefCount == 0 {
outStream.Write([]byte(imageIDsStr))
} Looks like technically it's not difficult to return both, but having some concerns about that;
I see there's a tests that validate that exact behavior (https://github.com/moby/moby/blob/ad1b781e44fa1e44b9e654e5078929aec56aed66/integration-cli/docker_cli_save_load_test.go#L395-L405) Looking at the history of that one, I see it was added in Docker 1.12 (through moby/moby#23377, which was a carry of moby/moby#23007), and has been around for a while, which increases the risk of a change being potentially breaking. |
Thanks for a prompt and thorough analysis. I think all the info (in the single tag printing mode at least) should be provided on a single line. However, I admit the change in format is a concern, so to avoid breakage the new, more informative format should be introduced with a cmd line switch: |
Any chance to have any solution implemented within any reasonable period? |
I would definitely appreciate an update. |
Bump. |
Any progress? This would be highly useful for us. |
Using Docker version 20.10.9, it already prints "Loaded image: " on stdout, so you can pipe it to other shell commands to get the ID instead:
|
Also, loading + extracting image ID in one line. Ref: docker/cli#2212 (comment)
Description
I propose that
docker image load
return, apart from the image name, the assigned image ID. That would save an extra step of listing images in order to find it. It would also make the command consistent with container creation which does return container ID.Describe the results you received:
Describe the results you expected:
I'd prefer to see also the image ID being returned.
The text was updated successfully, but these errors were encountered: