mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-31 05:40:42 +00:00 
			
		
		
		
	godep restore pushd $GOPATH/src/github.com/appc/spec git co master popd go get go4.org/errorutil rm -rf Godeps godep save ./... git add vendor git add -f $(git ls-files --other vendor/) git co -- Godeps/LICENSES Godeps/.license_file_state Godeps/OWNERS
		
			
				
	
	
		
			35 lines
		
	
	
		
			974 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			974 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package client
 | |
| 
 | |
| import (
 | |
| 	"io"
 | |
| 	"net/url"
 | |
| 
 | |
| 	"golang.org/x/net/context"
 | |
| 
 | |
| 	"github.com/docker/engine-api/types"
 | |
| 	"github.com/docker/engine-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)
 | |
| 	if err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 
 | |
| 	query := url.Values{}
 | |
| 	query.Set("fromImage", repository)
 | |
| 	query.Set("tag", tag)
 | |
| 	resp, err := cli.tryImageCreate(ctx, query, options.RegistryAuth)
 | |
| 	if err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 	return resp.body, nil
 | |
| }
 | |
| 
 | |
| func (cli *Client) tryImageCreate(ctx context.Context, query url.Values, registryAuth string) (*serverResponse, error) {
 | |
| 	headers := map[string][]string{"X-Registry-Auth": {registryAuth}}
 | |
| 	return cli.post(ctx, "/images/create", query, nil, headers)
 | |
| }
 |