mirror of https://github.com/docker/cli.git
Merge pull request #1371 from jhowardmsft/jjh/importlcow
LCOW: --platform on import (already in API)
This commit is contained in:
commit
b4180e8757
|
@ -19,6 +19,7 @@ type importOptions struct {
|
||||||
reference string
|
reference string
|
||||||
changes dockeropts.ListOpts
|
changes dockeropts.ListOpts
|
||||||
message string
|
message string
|
||||||
|
platform string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewImportCommand creates a new `docker import` command
|
// NewImportCommand creates a new `docker import` command
|
||||||
|
@ -43,6 +44,7 @@ func NewImportCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
options.changes = dockeropts.NewListOpts(nil)
|
options.changes = dockeropts.NewListOpts(nil)
|
||||||
flags.VarP(&options.changes, "change", "c", "Apply Dockerfile instruction to the created image")
|
flags.VarP(&options.changes, "change", "c", "Apply Dockerfile instruction to the created image")
|
||||||
flags.StringVarP(&options.message, "message", "m", "", "Set commit message for imported image")
|
flags.StringVarP(&options.message, "message", "m", "", "Set commit message for imported image")
|
||||||
|
command.AddPlatformFlag(flags, &options.platform)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
@ -73,6 +75,7 @@ func runImport(dockerCli command.Cli, options importOptions) error {
|
||||||
importOptions := types.ImageImportOptions{
|
importOptions := types.ImageImportOptions{
|
||||||
Message: options.message,
|
Message: options.message,
|
||||||
Changes: options.changes.GetAll(),
|
Changes: options.changes.GetAll(),
|
||||||
|
Platform: options.platform,
|
||||||
}
|
}
|
||||||
|
|
||||||
clnt := dockerCli.Client()
|
clnt := dockerCli.Client()
|
||||||
|
|
|
@ -24,6 +24,7 @@ Options:
|
||||||
-c, --change value Apply Dockerfile instruction to the created image (default [])
|
-c, --change value Apply Dockerfile instruction to the created image (default [])
|
||||||
--help Print usage
|
--help Print usage
|
||||||
-m, --message string Set commit message for imported image
|
-m, --message string Set commit message for imported image
|
||||||
|
--platform string Set platform if server is multi-platform capable
|
||||||
```
|
```
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
@ -87,3 +88,11 @@ Note the `sudo` in this example – you must preserve
|
||||||
the ownership of the files (especially root ownership) during the
|
the ownership of the files (especially root ownership) during the
|
||||||
archiving with tar. If you are not root (or the sudo command) when you
|
archiving with tar. If you are not root (or the sudo command) when you
|
||||||
tar, then the ownerships might not get preserved.
|
tar, then the ownerships might not get preserved.
|
||||||
|
|
||||||
|
## When the daemon supports multiple operating systems
|
||||||
|
If the daemon supports multiple operating systems, and the image being imported
|
||||||
|
does not match the default operating system, it may be necessary to add
|
||||||
|
`--platform`. This would be necessary when importing a Linux image into a Windows
|
||||||
|
daemon.
|
||||||
|
|
||||||
|
# docker import --platform=linux .\linuximage.tar
|
||||||
|
|
|
@ -38,5 +38,13 @@ This example sets the docker image ENV variable DEBUG to true by default.
|
||||||
|
|
||||||
# tar -c . | docker image import -c="ENV DEBUG true" - exampleimagedir
|
# tar -c . | docker image import -c="ENV DEBUG true" - exampleimagedir
|
||||||
|
|
||||||
|
## When the daemon supports multiple operating systems
|
||||||
|
If the daemon supports multiple operating systems, and the image being imported
|
||||||
|
does not match the default operating system, it may be necessary to add
|
||||||
|
`--platform`. This would be necessary when importing a Linux image into a Windows
|
||||||
|
daemon.
|
||||||
|
|
||||||
|
# docker image import --platform=linux .\linuximage.tar
|
||||||
|
|
||||||
# See also
|
# See also
|
||||||
**docker-export(1)** to export the contents of a filesystem as a tar archive to STDOUT.
|
**docker-export(1)** to export the contents of a filesystem as a tar archive to STDOUT.
|
||||||
|
|
Loading…
Reference in New Issue