diff options
author | Derek McGowan <derek@mcgstyle.net> | 2017-01-25 16:54:18 -0800 |
---|---|---|
committer | Derek McGowan <derek@mcgstyle.net> | 2017-02-07 11:08:37 -0800 |
commit | 3a1279393faf78632bf169619d407e584da84b66 (patch) | |
tree | 25d89487c1dcfc045a0dc8bfa72dd2cf31d28489 /client/image_create.go | |
parent | 2bea87393b7673fc88531851803f073198527021 (diff) | |
download | docker-3a1279393faf78632bf169619d407e584da84b66.tar.gz |
Use distribution reference
Remove forked reference package. Use normalized named values
everywhere and familiar functions to convert back to familiar
strings for UX and storage compatibility.
Enforce that the source repository in the distribution metadata
is always a normalized string, ignore invalid values which are not.
Update distribution tests to use normalized values.
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Diffstat (limited to 'client/image_create.go')
-rw-r--r-- | client/image_create.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/client/image_create.go b/client/image_create.go index cf023a7186..4436abb0dd 100644 --- a/client/image_create.go +++ b/client/image_create.go @@ -6,21 +6,21 @@ import ( "golang.org/x/net/context" + "github.com/docker/distribution/reference" "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/reference" ) // ImageCreate creates a new image based in the parent options. // It returns the JSON content in the response body. func (cli *Client) ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { - repository, tag, err := reference.Parse(parentReference) + ref, err := reference.ParseNormalizedNamed(parentReference) if err != nil { return nil, err } query := url.Values{} - query.Set("fromImage", repository) - query.Set("tag", tag) + query.Set("fromImage", reference.FamiliarName(ref)) + query.Set("tag", getAPITagFromNamedRef(ref)) resp, err := cli.tryImageCreate(ctx, query, options.RegistryAuth) if err != nil { return nil, err |