Commit Graph

38 Commits

Author SHA1 Message Date
Simon Ferquel b34f340346 Introduce docker context store
This PR adds a store to the CLI, that can be leveraged to persist and
retrieve credentials for various API endpoints, as well as
context-specific settings (initially, default stack orchestrator, but we
could expand that).

This comes with the logic to persist and retrieve endpoints configs
for both Docker and Kubernetes APIs.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2019-01-04 17:06:51 +01:00
Benoit Sigoure 7e9e2c10bc cli/config/configfile: Atomically rewrite the config file when saving.
The config file was being truncated first, which created a window during
which it was empty, causing concurrent uses of the `docker` command to
potentially fail with:
  WARNING: Error loading config file: /var/lib/jenkins/.docker/config.json: EOF
  Error response from daemon: Get https://registry/v2/foo/manifests/latest: no basic auth credentials

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
2018-09-10 13:43:24 -07:00
Vimal Raghubir ce3d069936
Fix: Warning Message
Signed-off-by: Vimal-Raghubir <vraghubir0418@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-13 13:39:24 +02:00
Euan Kemp 056015c3d8 config/credentials: don't run 'pass' to detect it
'CheckInitialized' in the credential-helper library actually invokes
`pass`, which isn't desirable (see #699).

This moves the check to be simpler, and then pass will only be invoked
when it's needed (such as for `docker login` or when pulling from a
private registry).

This logic could also reasonably live in the credential-helper library,
but it's simple enough it seems fine in either location.

Signed-off-by: Euan Kemp <euank@euank.com>
2018-06-29 11:38:39 -07:00
Vincent Demeester d9741fc96b
Update docker-credential-helpers dependency
This is mainly for the `pass` helper ; `pass` shouldn't be called
every docker command anymore ;).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-28 14:44:53 +02:00
Silvin Lubecki 71272dd203
Scope orchestration selection to stack commands only
* Renaming DOCKER_ORCHESTRATOR to DOCKER_STACK_ORCHESTRATOR
* Renaming config file option "orchestrator" to "stackOrchestrator"
* "--orchestrator" flag is no more global but local to stack command and subcommands
* Cleaning all global orchestrator code
* Replicating Hidden flags in help and Supported flags from root command to stack command

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-06-21 17:12:31 -07:00
Vincent Demeester 2c4de4fb5e
Update tests to use gotest.tools 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 18:24:26 +02:00
Silvin Lubecki fb34ffc327 Check allNamespace config value while loading configuration file
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2018-05-28 15:15:25 +02:00
Mathieu Champlon 1c1300bef6 Imply all Kubernetes namespaces for docker stack list when orchestrator is all or Kubernetes
* Add "kubernetes" struct in config file with "allNamespaces" option, to opt-out this behavior when set as "disabled"

Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
2018-05-28 10:43:32 +02:00
Vincent Demeester 4290df3958 print a big warning about cleartext passwords
Signed-off-by: Tycho Andersen <tycho@docker.com>
2018-03-26 16:18:32 +02:00
Daniel Nephin baf65a5502 Convert to assert.NilError
Using:

  git grep -l '^\s\+assert\.Check(t, err)$' | \
    xargs sed -i -e 's/^\(\s\+assert\)\.Check(t, err)$/\1.NilError(t, err)/'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-06 15:27:34 -05:00
Daniel Nephin 681c921528 Remove testutil
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-06 14:38:35 -05:00
Daniel Nephin 789acb526c Cleanup config load error handling
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-06 13:44:06 -05:00
Daniel Nephin 7c8b5708eb Don't set a default filename for ConfigFile
With a default filename tests will leave a file in the working directory
that is never cleaned up.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-06 13:32:50 -05:00
Daniel Nephin 39c2ca57c1 Automated migration
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2018-03-05 19:41:17 -05:00
Vincent Demeester 69432c48db
Merge pull request #840 from dekkagaijin/master
GetAll -> Get to retrieve credentials from credential helpers
2018-02-16 15:38:53 +01:00
Ivan Markin 57c51c8af3 Fix compilation of defaultCredentialStore() on unsupported platforms
Signed-off-by: Ivan Markin <sw@nogoegst.net>
2018-02-10 15:30:32 +00:00
Jake Sanders e1b607a351 defaultIndexserver -> defaultIndexServer
Signed-off-by: Jake Sanders <jsand@google.com>
2018-02-09 13:48:01 -08:00
Jake Sanders 1d0a37c460 Use Get rather than GetAll to retrieve credentials from credential helpers.
Signed-off-by: Jake Sanders <jsand@google.com>
2018-02-05 20:31:46 -08:00
Vincent Demeester 8417e49792 Add support for kubernetes in docker cli
- Add support for kubernetes for docker stack command
- Update to go 1.9
- Add kubernetes to vendors
- Print orchestrator in docker version command

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
2017-12-26 11:22:32 +01:00
Vincent Demeester 84fe1a1b5b
Add support for experimental Cli configuration
Allow to mark some commands and flags experimental on cli (i.e. not
depending to the state of the daemon). This will allow more flexibility
on experimentation with the cli.

Marking `docker trust` as cli experimental as it is documented so.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-12-22 14:48:47 +01:00
Abdur Rehman c3fe9d85ef fix a number of minor typos
Fix 19 typos, grammatical errors and duplicated words.

These fixes have minimal impact on the code as these are either in the
doc files or in comments inside the code files.

Signed-off-by: Abdur Rehman <abdur_rehman@mentor.com>
2017-10-31 15:21:51 +05:00
Tycho Andersen 713e87e780 prefer `pass` backend if it is available
Signed-off-by: Tycho Andersen <tycho@docker.com>
2017-09-20 11:15:49 -06:00
Tycho Andersen 4cf1849418 defaultCredentialStore: make this a function
In the next patch, we'll use this to implement some logic about which
password backend to use.

Signed-off-by: Tycho Andersen <tycho@docker.com>
2017-09-20 11:14:27 -06:00
Daniel Nephin 846a31aa50 Use new internal testutil.ErrorContains()
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-08-22 10:14:25 -04:00
Vincent Demeester 105b21d1ab
Rename NewConfigFile to New in configfile package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-27 16:31:38 +02:00
Daniel Nephin 62dfbef4d8
Add missing unit tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-27 13:46:47 +02:00
Daniel Nephin a3cbc70147
Move credential getting functions to the ConfigFile.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-27 13:46:47 +02:00
Daniel Nephin 33cbb70270
Cleanup config/credentials, remove dependency on config file.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-27 13:45:50 +02:00
Daniel Nephin a8c70e43a3
Move config file loading to more appropriate packages.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-27 13:45:50 +02:00
Daniel Nephin b84e21cd05 Fix lint errors merged while new lint branch was in PR.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-21 00:11:59 -04:00
Brian Goff 2bfac7fcda Merge pull request #176 from dnephin/new-lint
New linters
2017-06-20 16:47:45 -07:00
Dave Tucker 35f1e301b5 Allow Proxy Configuration in config.json
This commit modifies config.json to allow for any proxies allowed in
build-args to be configured. These values will then be used
by default as build-args in docker build.

Signed-off-by: Dave Tucker <dt@docker.com>
2017-06-20 09:51:41 +01:00
Daniel Nephin 3724fb7f37 Add gosimple lint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-06-14 16:55:08 -07:00
Aaron Lehmann db5620026d Add support for configs
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-05-11 13:42:49 -07:00
Daniel Nephin b86533c479 Add ineffassign linter.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-05-02 17:57:46 -04:00
Daniel Nephin 10641c2aae Update imports.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-04-17 18:07:56 -04:00
Daniel Nephin 1630fc40f8 Import docker/docker/cli
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-04-17 17:40:59 -04:00