1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/api/client/lib/image_create.go
David Calavera 8b15839ee8 Create interface that clients that talk to the api must fulfill.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:58 -05:00

23 lines
582 B
Go

package lib
import (
"io"
"net/url"
"github.com/docker/docker/api/types"
)
// ImageCreate creates a new image based in the parent options.
// It returns the JSON content in the response body.
func (cli *Client) ImageCreate(options types.ImageCreateOptions) (io.ReadCloser, error) {
var query url.Values
query.Set("fromImage", options.Parent)
query.Set("tag", options.Tag)
headers := map[string][]string{"X-Registry-Auth": {options.RegistryAuth}}
resp, err := cli.POST("/images/create", query, nil, headers)
if err != nil {
return nil, err
}
return resp.body, nil
}