Commit Graph

71 Commits

Author SHA1 Message Date
8a7585ce8e Client credentials store.
This change implements communication with an external credentials store,
ala git-credential-helper. The client falls back the plain text store,
what we're currently using, if there is no remote store configured.

It shells out to helper program when a credential store is
configured. Those programs can be implemented with any language as long as they
follow the convention to pass arguments and information.

There is an implementation for the OS X keychain in https://github.com/calavera/docker-credential-helpers.
That package also provides basic structure to create other helpers.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: cf721c23e715e545eccf8484e145c2d18d6a6a23
Component: engine
2016-02-29 13:01:31 -05:00
32fac24f32 Apply context changes to the client.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: fe53be4e1785ab4d8cadf246e5f2de419f337adc
Component: engine
2016-02-04 13:59:57 -05:00
27daf9cbce Windows: Add support for named pipe protocol
This adds an npipe protocol option for Windows hosts, akin to unix
sockets for Linux hosts. This should become the default transport
for Windows, but this change does not yet do that.

It also does not add support for the client side yet since that
code is in engine-api, which will have to be revendored separately.

Signed-off-by: John Starks <jostarks@microsoft.com>
Upstream-commit: 0906195fbbd6f379c163b80f23e4c5a60bcfc5f0
Component: engine
2016-02-01 19:46:30 -08:00
2c45eb2fa9 Skip Close()-ing stdin on Darwin. The Return.
This was accidentally removed in https://github.com/docker/docker/pull/16289
Now adding it back.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 51795c083624b106fe7f338213cbc3d3812f31af
Component: engine
2016-02-01 20:38:01 -05:00
31eb5171fa Move tty set and restore to caller
Fixes #19506

This fixes the issue of errors on create and the tty not being able to
be restored to its previous state because of a race where it was
in the hijack goroutine.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: a1eb6029cc4e4ccd820b0aac147a6121f1967ba2
Component: engine
2016-01-20 13:32:19 -08:00
dbccbefa60 Make sure docker api client implements engine-api client.
- Use the master interface in the new repo.
- Use new structures for container create, update and network connect.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: e73ab750edc006324d1019b828c8ec9c551b9717
Component: engine
2016-01-07 21:02:19 -05:00
4ec2693c9e Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 907407d0b2e5863f0e1b40b93a356bbf03c7b9fb
Component: engine
2016-01-06 19:48:59 -05:00
51b37769f0 Remove usage of pkg sockets and tlsconfig.
- Use the ones provided by docker/go-connections, they are a drop in replacement.
- Remove pkg/sockets from docker.
- Keep pkg/tlsconfig because libnetwork still needs it and there is a
  circular dependency issue.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 8e034802b7ad92a29f08785e553415adcd1348a3
Component: engine
2015-12-29 19:27:12 -05:00
f41d29a49b Add --format support to images command
- rename `api/client/ps` to `api/client/formatter`
- add a a image formatter

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 34a3c3cacf2fd827f13a5e37541acff1409658c4
Component: engine
2015-12-21 17:38:07 +01:00
76f3bf50c1 pkg/version.Version: use the new String() method
Resolves #18750

Signed-off-by: Aditi Rajagopal <arajagopal@us.ibm.com>
Upstream-commit: 278e75800c7be10ca43ffb11de25cd342da106fe
Component: engine
2015-12-18 15:29:32 -05:00
da94425c54 Remove api client lib dependency on tlsconfig and sockets packages.
- Let consumers to configure the http transport initially and apply or
  defaults on top.
- Add function to initialize a new client based on environment
  variables, useful for integrators.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: defd1519f77ef0caaab2cfeeb6433c8a24c62ffc
Component: engine
2015-12-17 19:04:49 -05:00
6a842265ad Add a DOCKER_API_VERSION env var
Closes: #11486

Just for @ahmetalpbalkan  :-)

Fixed some comment formatting too while in there.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 6287ec9095f380449f0b4f1a06d4e5df43fc4449
Component: engine
2015-12-14 12:45:34 -08:00
a55d187756 Force API versioning in the client library.
Remove dependencies on docker's version packages.
Allow empty version as a fallback to latest version.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: b679eb9a8263d2cb00fecc8741d62d2b35db5ac5
Component: engine
2015-12-14 12:06:42 -05:00
1c8ead7dbd Remove old http from the docker cli.
Everything has been ported to the client library 🎉

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 5a0a6ee9cd55f3e2f57d992a032421d0e126040d
Component: engine
2015-12-09 12:05:00 -05:00
964dd12e59 Create interface that clients that talk to the api must fulfill.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 8b15839ee85b291266d07f97d9ad6ca0326d1339
Component: engine
2015-12-09 12:04:58 -05:00
6ac2615d60 Extract API client struct as standalone client.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 589df17a1a1dc649a4c3095cea6dd05e0c2a3bb5
Component: engine
2015-12-09 12:04:53 -05:00
f833d205f0 Make default tls host work
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: fbb01b816288c5cf3eb79358c035072766b6e0f0
Component: engine
2015-10-19 21:17:37 +08:00
bb94a5ee85 Remove used param on ParseHost
The first param on opts.ParseHost() wasn't being used for anything.

Once we get rid of that param we can then also clean-up some code
that calls ParseHost() because the param that was passed in wasn't
being used for anything else.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: ba973f2d74c150154390aed1a5aed8fb5d0673b8
Component: engine
2015-10-11 20:45:17 -07:00
4e6b402919 Default the tcp port to 2376 if tls is on, and 2375 if not
Refactor so that the Host flag validation doesn't destroy the user's input,
and then post process the flags when we know the TLS options

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
Upstream-commit: 50f0906007bdec83dd23b6ae5216769ab65bbf59
Component: engine
2015-10-09 17:48:03 -07:00
b7b1e671cd Refactor CLI docker save
Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 22be1e443fa49bafd6aa3ab6c1eb0595fd9fb2b1
Component: engine
2015-09-11 15:31:55 +08:00
61c2d57722 Use default no-op uuid.Loggerf for client cli
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 3face3c521127cb86570c68d5f2a8f55e7633146
Component: engine
2015-07-30 21:19:51 -04:00
74a4e76af0 Set uuid.Loggerf to nop on client and to logrus.Warnf on daemon
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 7841d6ab9a58aff1d607eea7303c665c159ceaec
Component: engine
2015-07-29 17:49:59 -04:00
36ee6380c9 api/client fix golint errors/warnings
Addresses #14756

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: 929f2c2f4074e66bb1e942a338e4d2a815096d45
Component: engine
2015-07-29 17:20:54 +00:00
12234c67d4 cli: new daemon command and new cli package
This patch creates a new cli package that allows to combine both client
and daemon commands (there is only one daemon command: docker daemon).

The `-d` and `--daemon` top-level flags are deprecated and a special
message is added to prompt the user to use `docker daemon`.

Providing top-level daemon-specific flags for client commands result
in an error message prompting the user to use `docker daemon`.

This patch does not break any old but correct usages.

This also makes `-d` and `--daemon` flags, as well as the `daemon`
command illegal in client-only binaries.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 96ce3a194aab2807fdd638825b9ea7cb9ba55c36
Component: engine
2015-07-23 19:44:46 -04:00
a746d5f280 Docker ps custom formatting.
Docker-DCO-1.1-Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 37209190c76de66531acba848f1537da2899e32d
Component: engine
2015-07-20 22:46:55 -04:00
22fa301a78 add support for base path in docker cli -H
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 47a7f770f42bc0fd9b0a594b72a8f20fb4b874d1
Component: engine
2015-07-08 15:42:40 -07:00
3e1377983b Add support for DOCKER_CONFIG/--config to specific config file dir
Carry #11675

Aside from what #11675 says, to me a key usecase for this is to support
more than one Docker cli running at the same time but each may have its
own set of config files.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: daced1d30345aca06857f874dfb48b7e90cb409b
Component: engine
2015-07-10 12:51:34 -07:00
7b3bea6e05 Plugins JSON spec.
Allow full configuration of external plugins via a JSON document.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 333ac3a3eb09c29c42fe2cea1680621700b67b2f
Component: engine
2015-06-29 10:32:18 -07:00
8f5fcaf455 api/client: Allow for multi-line usage help
Subcommands can provide multiple usage synopses.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 4cb0c93f9287d29934894c871d156801122516cd
Component: engine
2015-06-10 16:14:45 -07:00
9749c4b6ff Merge pull request #13428 from duglin/niceHelp2
Nice help2
Upstream-commit: 617a0c2fde69f2954c2d8959e23e1459636f753e
Component: engine
2015-05-28 11:09:02 -07:00
743c9dbd95 Carry #11858
Continues 11858 by:
- Making sure the exit code is always zero when we ask for help
- Making sure the exit code isn't zero when we print help on error cases
- Making sure both short and long usage go to the same stream (stdout vs stderr)
- Making sure all docker commands support --help
- Test that all cmds send --help to stdout, exit code 0, show full usage, no blank lines at end
- Test that all cmds (that support it) show short usage on bad arg to stderr, no blank line at end
- Test that all cmds complain about a bad option, no blank line at end
- Test that docker (w/o subcmd) does the same stuff mentioned above properly

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 8324d7918b9c84c5f6508064801534dfd2155c90
Component: engine
2015-05-23 09:14:18 -07:00
89782c55eb Volumes refactor and external plugin implementation.
Signed by all authors:

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
Signed-off-by: Jeff Lindsay <progrium@gmail.com>
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Signed-off-by: Luke Marsden <luke@clusterhq.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 81fa9feb0cdc0773eff99d7393c16271e84aac08
Component: engine
2015-05-21 20:34:17 -07:00
843afe9ea1 adding nicer help when missing arguments (#11858)
Signed-off-by: Jason Shepherd <jason@jasonshepherd.net>
Upstream-commit: 48231d623fb08eff9da589d6690b10a464df4ec5
Component: engine
2015-05-19 12:02:13 +10:00
2e83148ffd Use stderr instead of logrus for CLI error messages
Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 0024935f641ab596732f9162d3eab795bbc2ae06
Component: engine
2015-05-12 17:22:41 -07:00
50a36ca638 a few cleanups for client output
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: 5a6db4fd44c0e05c8b185174a9aa380c9cc4f719
Component: engine
2015-05-05 15:59:17 +08:00
c8f1332dce Move CLI config processing out from under registry dir
No logic changes should be in here, just moving things around.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: bb9da6ba9294a8eab8f4dfaf7cf07c57959fe608
Component: engine
2015-04-23 10:18:38 -07:00
ed4e61e70a Fix golint errors in docker/api/client
Signed-off-by: Peggy Li <peggyli.224@gmail.com>
Upstream-commit: 58065d0dd9adec4b2f397a453652cc8cc7237a17
Component: engine
2015-04-22 00:14:23 -07:00
44c88b9112 Add .docker/config.json and support for HTTP Headers
This PR does the following:
- migrated ~/.dockerfg to ~/.docker/config.json. The data is migrated
  but the old file remains in case its needed
- moves the auth json in that fie into an "auth" property so we can add new
  top-level properties w/o messing with the auth stuff
- adds support for an HttpHeaders property in ~/.docker/config.json
  which adds these http headers to all msgs from the cli

In a follow-on PR I'll move the config file process out from under
"registry" since it not specific to that any more. I didn't do it here
because I wanted the diff to be smaller so people can make sure I didn't
break/miss any auth code during my edits.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: 18c9b6c6455f116ae59cde8544413b3d7d294a5e
Component: engine
2015-04-20 13:05:24 -07:00
1ec6ea18ce add docs for DockerCli and NewDockerCli
Signed-off-by: buddhamagnet <buddhamagnet@gmail.com>
Upstream-commit: 69747b3c1e254d78619b2d66340f5d5172280d90
Component: engine
2015-04-14 18:33:11 +01:00
ef0a4fa398 Add godoc-style docstrings to Cmd... methods
Signed-off-by: Peggy Li <peggyli.224@gmail.com>
Upstream-commit: b5d0380108dde9e96d51bb01821860a0799dee0d
Component: engine
2015-03-25 14:17:11 -07:00
6c2adcb2c5 Use syscall consts, check for errors,
Also rename func for non-windows specific names.

Signed-off-by: Sachin Joshi <sachin_jayant_joshi@hotmail.com>
Upstream-commit: 45262c4cb057e78ba98d02b5e0121ed402779c7f
Component: engine
2015-03-16 14:04:56 -07:00
78e67ff2df ANSI terminal emulation for windows
It is implemented by intercepting and interpreting the output
escape sequence by calling win32 console apis.

In addition the input from win32 console is translated to linux keycodes

Signed-off-by: Sachin Joshi <sachin_jayant_joshi@hotmail.com>
Upstream-commit: d8c3090dd9abe3f0d95f99c9d8c7660922e9a719
Component: engine
2015-03-16 14:04:49 -07:00
362dc0b239 Normalize the log for docker subcommand usage,
delete unecessary blank after "[OPTIONS] "
and add a blank to the log between options and signature.

To make the code style consistency.

Signed-off-by: Zen Lin(Zhinan Lin) <linzhinan@huawei.com>
Upstream-commit: 2b051bcbda06ec48287e75da506bacf95be2b652
Component: engine
2015-03-11 18:58:32 +08:00
106678e894 Do not use HTTP_PROXY for unix sock
Makes sure the CLI does not use HTTP_PROXY when connecting to unix
socket.
Also adds some tests to make sure this functionality works as expected.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: f6e697d2ace2ea659c1b3f7e3dcef7493baa481c
Component: engine
2015-02-12 11:38:52 -05:00
62119ca587 Export $HOME lookup to pkg/homedir
Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Upstream-commit: f9ae2d4fd4c5b4afb7a2299b93a800f718b63a2a
Component: engine
2015-02-06 11:42:45 -08:00
63b6feced2 Extract $HOME usages into utils.GetHomeDir()
Refactored getHomeDir in docker/docker to GetHomeDir in utils
pkg. Currently covers all use cases on the client-side.

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Upstream-commit: 6ffb77afd4c3705322417f0673d254038f01a187
Component: engine
2015-02-05 16:13:51 -08:00
eb1117987a Defer creation of trust key file until needed
Fixes #10442

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 0eed1f4d8da893d7c91be811197032a064053155
Component: engine
2015-01-29 13:46:12 -08:00
d7d0e51f38 Add ProxyFromEnvironment enables client via proxy.
Signed-off-by: Anders Janmyr <anders@janmyr.com>
Upstream-commit: 43d45e601fa13bc43228ae3b76b1b5c5737b0558
Component: engine
2015-01-08 08:12:31 +01:00
fa232dc1ae Exit with non-zero code on first argument parsing error
Ignoring return value of ParseFlags leads to exit code 0 if bad
arguments are supplied. This patch makes sure that subcommands exit
with non-zero code in such a case.

Signed-off-by: Michal Minar <miminar@redhat.com>
Upstream-commit: 8a785792cd3c3fb4494bced475263aef5fa4534b
Component: engine
2015-01-06 13:46:38 +01:00
f82eddabc6 --help option and help command should print to stdout not stderr
--help and help are successful commands so output should not go to error.

    QE teams have requested this change, also users doing docker help | less
    or docker run --help | less would expect this to work.

    Usage statement should only be printed when the user asks for it.
    Errors should print error message and then suggest the docker COMMAND --help
    command to see usage information.

    The current behaviour causes the user to have to search for the error message
    and sometimes scrolls right off the screen.  For example a error on a
    "docker run" command is very difficult to diagnose.

    Finally erros should always exit with a non 0 exit code, if the user
    makes a CLI error.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
Upstream-commit: a2b529ead21e6ab9eafcb1b1d2437c725c43a06a
Component: engine
2015-01-06 13:40:14 +01:00