Commit graph

70 commits

Author SHA1 Message Date
David Calavera
fe53be4e17 Apply context changes to the client.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-04 13:59:57 -05:00
John Starks
0906195fbb 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>
2016-02-01 19:46:30 -08:00
Tibor Vass
51795c0836 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>
2016-02-01 20:38:01 -05:00
Michael Crosby
a1eb6029cc 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>
2016-01-20 13:32:19 -08:00
David Calavera
e73ab750ed 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>
2016-01-07 21:02:19 -05:00
David Calavera
907407d0b2 Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-06 19:48:59 -05:00
David Calavera
8e034802b7 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>
2015-12-29 19:27:12 -05:00
Vincent Demeester
34a3c3cacf 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>
2015-12-21 17:38:07 +01:00
Aditi Rajagopal
278e75800c pkg/version.Version: use the new String() method
Resolves #18750

Signed-off-by: Aditi Rajagopal <arajagopal@us.ibm.com>
2015-12-18 15:29:32 -05:00
David Calavera
defd1519f7 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>
2015-12-17 19:04:49 -05:00
Doug Davis
6287ec9095 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>
2015-12-14 12:45:34 -08:00
David Calavera
b679eb9a82 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>
2015-12-14 12:06:42 -05:00
David Calavera
5a0a6ee9cd Remove old http from the docker cli.
Everything has been ported to the client library 🎉

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:05:00 -05:00
David Calavera
8b15839ee8 Create interface that clients that talk to the api must fulfill.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:58 -05:00
David Calavera
589df17a1a Extract API client struct as standalone client.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-09 12:04:53 -05:00
Lei Jitang
fbb01b8162 Make default tls host work
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2015-10-19 21:17:37 +08:00
Doug Davis
ba973f2d74 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>
2015-10-11 20:45:17 -07:00
Sven Dowideit
50f0906007 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>
2015-10-09 17:48:03 -07:00
Hu Keping
22be1e443f Refactor CLI docker save
Signed-off-by: Hu Keping <hukeping@huawei.com>
2015-09-11 15:31:55 +08:00
Tibor Vass
3face3c521 Use default no-op uuid.Loggerf for client cli
Signed-off-by: Tibor Vass <tibor@docker.com>
2015-07-30 21:19:51 -04:00
Tibor Vass
7841d6ab9a Set uuid.Loggerf to nop on client and to logrus.Warnf on daemon
Signed-off-by: Tibor Vass <tibor@docker.com>
2015-07-29 17:49:59 -04:00
root
929f2c2f40 api/client fix golint errors/warnings
Addresses #14756

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
2015-07-29 17:20:54 +00:00
Tibor Vass
96ce3a194a 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>
2015-07-23 19:44:46 -04:00
David Calavera
37209190c7 Docker ps custom formatting.
Docker-DCO-1.1-Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-07-20 22:46:55 -04:00
Victor Vieux
47a7f770f4 add support for base path in docker cli -H
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-07-08 15:42:40 -07:00
Doug Davis
daced1d303 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>
2015-07-10 12:51:34 -07:00
David Calavera
333ac3a3eb Plugins JSON spec.
Allow full configuration of external plugins via a JSON document.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-06-29 10:32:18 -07:00
Josh Hawn
4cb0c93f92 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)
2015-06-10 16:14:45 -07:00
David Calavera
617a0c2fde Merge pull request #13428 from duglin/niceHelp2
Nice help2
2015-05-28 11:09:02 -07:00
Doug Davis
8324d7918b 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>
2015-05-23 09:14:18 -07:00
David Calavera
81fa9feb0c 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>
2015-05-21 20:34:17 -07:00
Jason Shepherd
48231d623f adding nicer help when missing arguments (#11858)
Signed-off-by: Jason Shepherd <jason@jasonshepherd.net>
2015-05-19 12:02:13 +10:00
Doug Davis
0024935f64 Use stderr instead of logrus for CLI error messages
Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-05-12 17:22:41 -07:00
Qiang Huang
5a6db4fd44 a few cleanups for client output
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2015-05-05 15:59:17 +08:00
Doug Davis
bb9da6ba92 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>
2015-04-23 10:18:38 -07:00
Peggy Li
58065d0dd9 Fix golint errors in docker/api/client
Signed-off-by: Peggy Li <peggyli.224@gmail.com>
2015-04-22 00:14:23 -07:00
Doug Davis
18c9b6c645 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>
2015-04-20 13:05:24 -07:00
buddhamagnet
69747b3c1e add docs for DockerCli and NewDockerCli
Signed-off-by: buddhamagnet <buddhamagnet@gmail.com>
2015-04-14 18:33:11 +01:00
Peggy Li
b5d0380108 Add godoc-style docstrings to Cmd... methods
Signed-off-by: Peggy Li <peggyli.224@gmail.com>
2015-03-25 14:17:11 -07:00
Sachin Joshi
45262c4cb0 Use syscall consts, check for errors,
Also rename func for non-windows specific names.

Signed-off-by: Sachin Joshi <sachin_jayant_joshi@hotmail.com>
2015-03-16 14:04:56 -07:00
Sachin Joshi
d8c3090dd9 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>
2015-03-16 14:04:49 -07:00
Zen Lin(Zhinan Lin)
2b051bcbda 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>
2015-03-11 18:58:32 +08:00
Brian Goff
f6e697d2ac 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>
2015-02-12 11:38:52 -05:00
Ahmet Alp Balkan
f9ae2d4fd4 Export $HOME lookup to pkg/homedir
Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
2015-02-06 11:42:45 -08:00
Ahmet Alp Balkan
6ffb77afd4 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>
2015-02-05 16:13:51 -08:00
Derek McGowan
0eed1f4d8d Defer creation of trust key file until needed
Fixes #10442

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-01-29 13:46:12 -08:00
Anders Janmyr
43d45e601f Add ProxyFromEnvironment enables client via proxy.
Signed-off-by: Anders Janmyr <anders@janmyr.com>
2015-01-08 08:12:31 +01:00
Michal Minar
8a785792cd 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>
2015-01-06 13:46:38 +01:00
Dan Walsh
a2b529ead2 --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)
2015-01-06 13:40:14 +01:00
Arnaud Porterie
67e3ddb75f Forbid client piping to tty enabled container
Forbid `docker run -t` with a redirected stdin (such as `echo test |
docker run -ti busybox cat`). Forbid `docker exec -t` with a redirected
stdin. Forbid `docker attach` with a redirect stdin toward a tty enabled
container.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-12-09 14:30:49 -08:00