Skip to content

Commit

Permalink
Add docker.io to unqualified image name
Browse files Browse the repository at this point in the history
Since that's the default behavior of moby engine, the compat
API need to reflect that.

Fixes #12320

Signed-off-by: Michael Scherer <[email protected]>
  • Loading branch information
mscherer committed Nov 16, 2021
1 parent 197ebe8 commit 5ad0f0d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/api/handlers/compat/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ func CreateImageFromImage(w http.ResponseWriter, r *http.Request) {
// without this early check this function would return 200 but reported error via body stream soon after
// it's better to let caller know early via HTTP status code that request cannot be processed
_, err := shortnames.Resolve(runtime.SystemContext(), fromImage)
if err != nil && shortnames.IsShortName(fromImage) {
fromImage = fmt.Sprintf("%s/%s", "docker.io", fromImage)
_, err = shortnames.Resolve(runtime.SystemContext(), fromImage)
}
if err != nil {
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrap(err, "failed to resolve image name"))
return
Expand Down

0 comments on commit 5ad0f0d

Please sign in to comment.