mirror of https://github.com/docker/docs.git
docker load: add --input flag
for those that do not care to read from redirected stdin Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
This commit is contained in:
parent
e1035535ec
commit
84e1fdf35d
|
|
@ -2075,6 +2075,8 @@ func (cli *DockerCli) CmdSave(args ...string) error {
|
||||||
|
|
||||||
func (cli *DockerCli) CmdLoad(args ...string) error {
|
func (cli *DockerCli) CmdLoad(args ...string) error {
|
||||||
cmd := cli.Subcmd("load", "", "Load an image from a tar archive on STDIN")
|
cmd := cli.Subcmd("load", "", "Load an image from a tar archive on STDIN")
|
||||||
|
infile := cmd.String([]string{"i", "-input"}, "", "Read from a tar archive file, instead of STDIN")
|
||||||
|
|
||||||
if err := cmd.Parse(args); err != nil {
|
if err := cmd.Parse(args); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -2084,7 +2086,17 @@ func (cli *DockerCli) CmdLoad(args ...string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cli.stream("POST", "/images/load", cli.in, cli.out, nil); err != nil {
|
var (
|
||||||
|
input io.Reader = cli.in
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if *infile != "" {
|
||||||
|
input, err = os.Open(*infile)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := cli.stream("POST", "/images/load", input, cli.out, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -881,10 +881,19 @@ Known Issues (kill)
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
Usage: docker load < repository.tar
|
Usage: docker load
|
||||||
|
|
||||||
Loads a tarred repository from the standard input stream.
|
Load an image from a tar archive on STDIN
|
||||||
Restores both images and tags.
|
|
||||||
|
-i, --input"": Read from a tar archive file, instead of STDIN
|
||||||
|
|
||||||
|
Loads a tarred repository from the standard input stream.
|
||||||
|
Restores both images and tags.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ sudo docker load < busybox.tar
|
||||||
|
$ sudo docker load --input busybox.tar
|
||||||
|
|
||||||
.. _cli_login:
|
.. _cli_login:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue