Signed-off-by: David Calavera <david.calavera@gmail.com> Upstream-commit: d9a62c5f2b11131d4b8c3d62af60cd7e6ceaa350 Component: engine
24 lines
583 B
Go
24 lines
583 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) {
|
|
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
|
|
}
|