Skip to content

Use context name in context file during import as a default #1933

@kinghuang

Description

@kinghuang

Description

The docker context import … command requires two arguments: CONTEXT and FILE|-. It would be nice if the CONTEXT argument could be made optional, and default to the name of the context specified in the context file.

Steps to reproduce the issue:

  1. Attempt to import a context specifying only one argument.
$ docker context import context-file

Describe the results you received:

"docker context import" requires exactly 2 arguments.
See 'docker context import --help'.

Usage:  docker context import CONTEXT FILE|-

Describe the results you expected:

The meta.json file in the context file has the name of the context it was exported from. The import command should default to this name, if no name is specified.

meta.json:

{  
   "Name": "a-context-name",
   …
}

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.0-rc2
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        f97efcc
 Built:             Wed Jun  5 01:37:12 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.0-beta3
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.4
  Git commit:       c55e026
  Built:            Thu Apr 25 19:13:00 2019
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc7+dev
  GitCommit:        029124da7af7360afa781a0234d1b083550f797c
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

N/A

Additional environment details (AWS, VirtualBox, physical, etc.):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions