docker / docker/cli

Use context name in context file during import as a default

Open
#1,933 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/context
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

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.):

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Docker CLI entry point for docker context import and trace its argument validation and context-file loading. Verify the behavior with a context archive whose meta.json contains Name; done means a single file argument imports using that name while the existing two-argument form still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.