Commit Graph

32 Commits

Author SHA1 Message Date
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
1d39a69298 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>
Upstream-commit: 67e3ddb75ff27b8de0022e330413b4308ec5b010
Component: engine
2014-12-09 14:30:49 -08:00
7632ac2e44 use _, _ string
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 454f56e37eefd072e350739a6c5a06743ff913ef
Component: engine
2014-11-14 19:31:52 +00:00
a7280b07fa update timeout
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 5fbfec333a90b86add1dcf6bd8d5fcb728d34cdf
Component: engine
2014-11-13 03:21:18 +00:00
ad5fd5c082 fix unix socket
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 6ca144ef3d62e358327249546bf83ce1e347be5c
Component: engine
2014-11-12 00:37:58 +00:00
f37e910c9f handle GET redirects
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 4b4ad26b977bba0b52f6ea15d08750a7453304a4
Component: engine
2014-11-12 00:37:58 +00:00
118bb8077c Fix help text being incorrect with multiple args
E.g. "docker foobar run" would have printed "Command not found:
foobar" and printed the help text for "run". It should instead
print the root help message for docker.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
Upstream-commit: ef004ec03fe5aad33da7d53f196f16382c750d07
Component: engine
2014-11-03 16:46:01 +00:00
7389bf879d client: even cleaner use of Transport
First off, sorry for the noise. This is a cleaner step of #8508

Found more of a root cause of the open file handles.
After more testing I found that the open file descriptors will still
occur for TCP:// connections to the daemon, causing client and/or daemon
to fail.

The issue was instantiating a new http.Transport on _ever_ client
request. So each instance held the prior connection alive, but was only
ever used once.

By moving it out to the initilization of DockerCli, we can now have
reuse of idled connections. Simplifies the garbage overhead of the
client too, though that's not usually a deal.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: da42ae536cf86dafbdad88901b9322ea7317f154
Component: engine
2014-10-12 22:32:55 -04:00
b5b7b0a681 Add libtrust key identity management
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: ea6a480128316be5494284dbb688b58bd65e6f63
Component: engine
2014-09-26 15:52:08 -07:00
e3880837c4 DockerCli: Check IsTerminal() for both STDIN and STDOUT
`docker events > /tmp/out` should not print control
characters to non-terminal STDOUT.

This addresses commit 26b4a4920adca614f6be17a96f254f331271faf0
without creating regression described in issue #6509.

Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
Upstream-commit: d742c57f534352b6cad596d0c9fe8cf84044e92a
Component: engine
2014-09-25 20:58:24 +02:00
5dfb514311 Fix #6509: Interactive container hangs when redirecting stdout
Cli IsTerminal() SYS_IOCTL operation should be determined from STDIN,
not from STDOUT.

Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
Upstream-commit: 40c7b53791b598364ffe2290c88875e4fc65be11
Component: engine
2014-09-25 20:14:25 +02:00
93e967ece5 Add support for multiple level CLI commands
E.g. "docker groups create" will attempt to call the function
CmdGroupsCreate

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
Upstream-commit: e1b968f1981f21470a67ed617c36f1c6802bd0a7
Component: engine
2014-09-19 10:43:50 -07:00
3cca8404b4 add the [OPTIONS] string automatically if there are flags defined
Signed-off-by: SvenDowideit <SvenDowideit@home.org.au>

Docker-DCO-1.1-Signed-off-by: SvenDowideit <SvenDowideit@home.org.au> (github: SvenDowideit)
Upstream-commit: 8c6c4a12b7bd53c01998988593789aa16a6d9ac8
Component: engine
2014-08-28 08:50:50 +10:00
676eea0fcd Revert "--help option and help command should print to stdout not stderr"
This reverts commit 61b129d81802e3c988cc0e67e488b24968dd748a.

Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 2e489073d94a7e2a5df115704a484c34f0b59f29
Component: engine
2014-08-27 18:59:13 +00:00
f13f1856df --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: 61b129d81802e3c988cc0e67e488b24968dd748a
Component: engine
2014-08-21 15:35:20 -04:00
301a2b811c Rename a method for clarity
Signed-off-by: Solomon Hykes <solomon@docker.com>
Upstream-commit: a110ce2f284d09df3e047b1999a1535770433d5f
Component: engine
2014-08-10 04:33:19 +00:00
b7e1bdfc34 Move declaration of DockerCli to top of file for readability
Signed-off-by: Solomon Hykes <solomon@docker.com>
Upstream-commit: 5e9b3727b8f5d101b7b1f859d4f95fdf8e91ed19
Component: engine
2014-08-10 04:31:59 +00:00
6ae4c9014c update go import path and libcontainer
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: b3ee9ac74e171e00f14027e39278013629e681b8
Component: engine
2014-07-24 22:19:50 +00:00
0ca8d92d2e This check was backwards.
If I do a

docker events  > /tmp/out

I do not want the control characters getting written to the file.
The check should check the output file not the input file.

Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: rhatdan)
Upstream-commit: 26b4a4920adca614f6be17a96f254f331271faf0
Component: engine
2014-05-21 17:37:40 -04:00
df1cb6f1b5 docker '' causes a golang crash.
This patch fixes the problem.

Docker-DCO-1.1-Signed-off-by: Daniel Walsh <dwalsh@redhat.com> (github: rhatdan)
Upstream-commit: bc081a03d85a88cc2160ade9256d96d7b84c4caa
Component: engine
2014-05-20 14:04:27 -04:00
1095c42f89 fix https
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: 45be6f6dff1a8be328e5ade008aae8f9062f5cef
Component: engine
2014-05-02 19:49:12 +00:00
3772f57532 split client in 2 files
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
Upstream-commit: ae9ed84fdab4db5cec663bbd2d4ba8bcad897dcc
Component: engine
2014-03-31 18:11:53 +00:00