Commit graph

2098 commits

Author SHA1 Message Date
Daniel Nephin
8a93ff1ffb Remove dead code from node update.
Also share mode code between update commands
and use flag constants

Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit cacaeab9db)
2016-06-30 16:47:39 -07:00
Daniel Nephin
0641b8ba9c Use flag constants for swarm flag.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit c08a50dbd1)
2016-06-30 16:47:39 -07:00
Daniel Nephin
7b0bb3f92c add more flag constants to service update.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit 9d1f3373b3)
2016-06-30 16:47:39 -07:00
Zhang Wei
c40debc362 Make --help information consistent
Other docker command always print "[OPTIONS]" right after `docker
COMMAND`, but `build` and `push` has inconsistent help message.

This commit will fix help information format.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
(cherry picked from commit 0e53976336)
2016-06-30 16:47:37 -07:00
Yong Tang
92ffbd2b52 Fix docker start error with renamed container
This fix tries to fix the issue raised in #23716 where `docker start`
causes an error of `No such container:` if the container has been
renamed before `docker start` returns.

The issue is that `docker start` use container name passed at the
beginning to check for exit code at the end of the `docker start`.

This fix addresses the issue by always use container's `ID` to get
the information during `docker start`.

Additional integration tests have been added to cover this fix.

This fix fixes #23716.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
(cherry picked from commit 6e86733b47)
2016-06-30 16:47:37 -07:00
Daniel Nephin
3c35da6029 Add tests for AutoAcceptOption
Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit c544649874)
2016-06-18 20:58:24 -07:00
Daniel Nephin
e090e2dbd4 Support a listen addr without a port, and add tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit 595e79b805)
2016-06-18 20:58:24 -07:00
Victor Vieux
6b2cd6e843 accept uppercase endpoint mode
Signed-off-by: Victor Vieux <vieux@docker.com>
(cherry picked from commit 8a0c5f1578)
2016-06-18 20:58:24 -07:00
Arnaud Porterie (icecrime)
f1f2461e09 Change docker service update semantics
Change `docker service update` to replace attributes of the target
service rather than augment them. One particular occurrence where the
previous behavior proved problematic is when trying to update a port
mapping: the merge semantics provided no way of removing published
ports, but strictly of adding more.

The utility merge* functions where renamed accordingly to update*.

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
(cherry picked from commit 1f8ab93b44)
2016-06-18 20:58:23 -07:00
Arnaud Porterie (icecrime)
944a8f16c7 Improve docker service inspect --pretty
Remove capitalization in placement, and remove spurious `\t`.

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
(cherry picked from commit 3c60b7b984)
2016-06-17 13:09:13 -07:00
Vincent Demeester
6eaac7be89 Update plugin command with defaulttag
This way, you don't have to specify the ":latest" tag for some command
and not for others

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
(cherry picked from commit cb321e82db)
2016-06-17 13:09:13 -07:00
Tibor Vass
2ae7330140 plugins: fix usage for plugin commands
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 65ed9daf70)
2016-06-17 13:09:12 -07:00
Tibor Vass
f24e5d79bc plugins: install should not automatically accept all permissions
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 4b70d4561e)
2016-06-17 13:09:12 -07:00
Tonis Tiigi
bbc214fa9b Add newline to promote/demote message
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 3386e3570a)
2016-06-17 13:09:12 -07:00
Anil Madhavapeddy
4b2883fac6 docker swarm: more consistent CLI help
This changes `docker swarm help` to be consistent with capitals
and removes full stops.

Before:

```
Commands:
  init        Initialize a Swarm.
  join        Join a Swarm as a node and/or manager.
  update      update the Swarm.
  leave       Leave a Swarm.
  inspect     Inspect the Swarm
```

After:

```
Commands:
  init        Initialize a Swarm
  join        Join a Swarm as a node and/or manager
  update      Update the Swarm
  leave       Leave a Swarm
  inspect     Inspect the Swarm
```

Signed-off-by: Anil Madhavapeddy <anil@docker.com>
(cherry picked from commit 0ec78739ac)
2016-06-17 13:09:12 -07:00
Anusha Ragunathan
82608cd4ce Add disable flag for plugin Install.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit 22e781e8e3)
2016-06-17 13:09:11 -07:00
Justin Cormack
445f4f2f3e Missing line feed after accepting node
Avoids
```
root@swarmatorium:~# docker node accept 3dnh6k13o44np9fwl83e7gh80
Node 3dnh6k13o44np9fwl83e7gh80 accepted in the swarm.root@swarmatorium:~#
```

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
(cherry picked from commit c34d752419)
2016-06-17 13:09:11 -07:00
Justin Cormack
b7a1f1a2d1 fix invalid typo in error message
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
(cherry picked from commit 2322ccb8ff)
2016-06-17 13:09:11 -07:00
Daniel Nephin
fb364d86fa Add some tests for bundlefile and improve the error messages for LoadFile
Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit c0ea589c1b)
2016-06-16 23:36:59 -07:00
Victor Vieux
d747fbc95c improve some messages in the node subcmds
Signed-off-by: Victor Vieux <vieux@docker.com>
(cherry picked from commit eb962235fb)
2016-06-16 23:36:58 -07:00
Tonis Tiigi
ab6abb799b Add cert-expiry to swarm update
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 7d8d51aa9d)
2016-06-16 23:36:58 -07:00
Victor Vieux
3635938b00 add some more fields in docker service inspect -p
Signed-off-by: Victor Vieux <vieux@docker.com>
(cherry picked from commit 4c9e21b674)
2016-06-16 23:36:58 -07:00
Derek McGowan
56b253fb3c Do not show empty tags for digest references in output
When a repository has a tag and digests, show tag for each digest value.
Do not duplicate rows for the same image name with both tag and digest.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
(cherry picked from commit 79eada3814)
2016-06-16 23:36:57 -07:00
Vincent Demeester
42f445565d Update ServiceInspectWithRaw
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
(cherry picked from commit 4a70cb5571)
2016-06-16 23:36:57 -07:00
Vincent Demeester
d9d24b6605 Update docker plugin install code…
… for more consistency (api side).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
(cherry picked from commit 2c82337b04)
2016-06-16 23:36:57 -07:00
Yong Tang
1ad7b517fa Add security info to docker info
The security infomation has already been added to `GET /info` in #21172.
However, it is not part of the output of `docker info` yet.

This fix adds the security information to `docker info`.

Additional tests has been added to cover changes.

This fix fixes #23500. This fix is related to #20909, #21172.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
(cherry picked from commit eee20b564f)
2016-06-16 23:36:56 -07:00
Stephen J Day
6c3d080e83 api/client/service: fix minor spelling error in service inspect
Signed-off-by: Stephen J Day <stephen.day@docker.com>
(cherry picked from commit 920e65ccbc)
2016-06-16 23:36:55 -07:00
Stephen J Day
c3015a22cb api/client/service: list running services over replicas
To provide users a view of service status, list the number of running
task over the requested number of replicas.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
(cherry picked from commit b86cb293ec)
2016-06-16 23:36:55 -07:00
Victor Vieux
7cc76facba fix docker swarm init/update --secret
Signed-off-by: Victor Vieux <vieux@docker.com>
(cherry picked from commit 085895342c)
2016-06-16 23:36:54 -07:00
Daniel Nephin
bb8996d62b Fix String() for some option types
and add unit tests for them.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit c26e7d8c91)
2016-06-16 23:36:54 -07:00
Anusha Ragunathan
3e44703cae Add basic integration tests for plugins.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit a2d48c9e4e)
2016-06-16 23:36:53 -07:00
Anusha Ragunathan
c82f23095a Add accept-permissions flag for install.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit ec4857da48)
2016-06-16 23:36:53 -07:00
Arnaud Porterie (icecrime)
187b6607a4 Service --update-parallelism defauls to 0
The `--update-parallelism` flaag should default to 0, which is
interpreted by the backend as unlimited. In other words, by default all
services should update simultaneously.

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
(cherry picked from commit f22d0174f3)
2016-06-16 23:36:53 -07:00
Tom Barlow
5e41ec703d Change 'invald' to 'invalid' in volume opts errors
Signed-off-by: Tom Barlow <tomwbarlow@gmail.com>
(cherry picked from commit bf988fc6ff)
2016-06-16 23:36:53 -07:00
Daniel Nephin
41d72e28c3 Change SCALE to REPLICAS.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit 4df0349948)
2016-06-16 23:36:52 -07:00
Drew Erny
c816f2c905 Remove the node leader column, show leader as status.
Removes the leader column from node ls and shows whether a node is the
leader in the manager status column instead.

Signed-off-by: Drew Erny <drew.erny@docker.com>
(cherry picked from commit 4104c1dc13)
2016-06-16 23:36:50 -07:00
Arnaud Porterie
9ba0504923 Merge pull request #23554 from vieux/node_update_name
fix docker node update via name
2016-06-15 02:36:42 +00:00
Arnaud Porterie
2e9aac59e2 Merge pull request #23553 from icecrime/heartbeat_as_duration
Make `--dispatcher-heartbeat-period` a duration
2016-06-15 02:36:17 +00:00
Arnaud Porterie
c0677565dc Merge pull request #23522 from docker/swarm-stack
Add experimental Docker Stack CLI commands
2016-06-15 02:22:01 +00:00
Tõnis Tiigi
aa1b507af6 Merge pull request #23552 from vieux/prevent_panics
prevent some panics in 'service update'
2016-06-14 19:08:46 -07:00
Arnaud Porterie (icecrime)
e6e1fd5d06
Make --dispatcher-heartbeat-period a duration
Make `--dispatcher-heartbeat-period` a duration in `docker swarm
update`, allowing to express the value as "5s", "1h", etc.

Signed-off-by: Arnaud Porterie (icecrime) <arnaud.porterie@docker.com>
2016-06-14 18:10:49 -07:00
Brian Goff
6ed921dc38 Merge pull request #23446 from tiborvass/plugins-experimental
Plugins: experimental support for new plugin management
2016-06-14 20:32:14 -04:00
Victor Vieux
78a48af37b fix docker node update via name
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-06-14 15:55:34 -07:00
Michael Crosby
c97fdbe3c5 Merge pull request #23415 from aboch/ll
Allow user to specify container's link-local addresses
2016-06-14 15:47:54 -07:00
Arnaud Porterie
a0e992eff7 Merge pull request #23525 from dnephin/fix_service_update_repliacs
Fix service update replicas
2016-06-14 22:41:08 +00:00
Victor Vieux
1d380243fc prevent some panics in 'service update'
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-06-14 15:37:27 -07:00
Alessandro Boch
1c4efb6aa0 Allow user to specify container's link-local addresses
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-14 14:28:33 -07:00
Tibor Vass
f37117045c plugins: experimental support for new plugin management
This patch introduces a new experimental engine-level plugin management
with a new API and command line. Plugins can be distributed via a Docker
registry, and their lifecycle is managed by the engine.
This makes plugins a first-class construct.

For more background, have a look at issue #20363.

Documentation is in a separate commit. If you want to understand how the
new plugin system works, you can start by reading the documentation.

Note: backwards compatibility with existing plugins is maintained,
albeit they won't benefit from the advantages of the new system.

Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-06-14 14:20:27 -07:00
Daniel Nephin
1b2c59bf86 Use constants for flag names.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-14 16:43:56 -04:00
Daniel Nephin
19d6960b5b Remove CmdTag.
This file was accidentally re-added as part of a rebase.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-14 15:09:38 -04:00
Michael Crosby
6381ed14d1 Merge pull request #22983 from mlaventure/multiple-runtimes
Add support for multiple runtimes
2016-06-14 11:59:34 -07:00
Daniel Nephin
71104bb592 Add experimental docker stack commands
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-14 14:56:35 -04:00
Brian Goff
87f31e379d Merge pull request #23523 from vieux/fix_mounts_swarm
fix 2 potential panics with mounts in swarm
2016-06-14 14:44:19 -04:00
Victor Vieux
ffeb9fcb2a fix 2 potential panics with mounts in swarm
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-06-14 09:25:39 -07:00
Vincent Demeester
2e6db51de7
Migrate cp command to cobra
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-14 17:16:59 +02:00
Kenfe-Mickael Laventure
7b2e5216b8 Add support for multiples runtimes
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-06-14 07:47:31 -07:00
Daniel Nephin
12a00e6017 Add Swarm management CLI commands
As described in our ROADMAP.md, introduce new Swarm management commands
to call to the corresponding API endpoints.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-06-13 22:17:15 -07:00
Tonis Tiigi
534a90a993 Add Swarm management backend
As described in our ROADMAP.md, introduce new Swarm management API
endpoints relying on swarmkit to deploy services. It currently vendors
docker/engine-api changes.

This PR is fully backward compatible (joining a Swarm is an optional
feature of the Engine, and existing commands are not impacted).

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Victor Vieux <vieux@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-06-13 22:16:18 -07:00
Tianyi Wang
5a0b53b5a3 Migrate ps command to cobra
Signed-off-by: Tianyi Wang <capkurmagati@gmail.com>
2016-06-14 11:59:37 +09:00
Alexander Morozov
f0193e278c Merge pull request #23256 from vdemeester/migrate-pull-push-to-cobra
Use spf13/cobra for docker push and docker pull
2016-06-13 14:16:42 -07:00
Alexander Morozov
a502158d8a Merge pull request #23265 from vdemeester/migrate-login-logout-to-cobra
Use spf13/cobra for docker login and docker logout
2016-06-13 14:15:46 -07:00
Alexander Morozov
e6c49bf71b Merge pull request #23309 from yongtang/23211-spf13-cobra-commit
Use spf13/cobra for docker commit
2016-06-13 14:13:37 -07:00
Vincent Demeester
4dafd107ad Merge pull request #22777 from WeiZhang555/wait-restarting
Bug fix: `docker run -i --restart always` hangs
2016-06-12 13:01:20 +02:00
Yong Tang
a72b45dbec Fix logrus formatting
This fix tries to fix logrus formatting by removing `f` from
`logrus.[Error|Warn|Debug|Fatal|Panic|Info]f` when formatting string
is not present.

This fix fixes #23459.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-11 13:16:55 -07:00
Alexander Morozov
ee8c512dc3 Merge pull request #23403 from WeiZhang555/split-utils
Move GetExitCode to package container and unexport it
2016-06-10 15:38:06 -07:00
Alexander Morozov
12970bef34 Merge pull request #23351 from thaJeztah/remove-go-1.4-fix
remove fallback for Go 1.4
2016-06-10 09:16:46 -07:00
Vincent Demeester
ad4e20cd92
Moving Image{Push,Pull}Privileged to trust.go
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-10 12:07:32 +02:00
Vincent Demeester
9640e3a451
Migrate push command to cobra
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-10 12:07:28 +02:00
Vincent Demeester
fa67b984f8
Migrate pull command to cobra
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-10 12:07:23 +02:00
Vincent Demeester
baf467722b
Migrate login & logout command to cobra
Also moves some common stuff around :
- `api/client/registry.go` for registry related
method (`ElectAuthServer`, …)
- `api/client/credentials.go` to interact with credentials

Migrate logout command to cobra

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-10 12:04:29 +02:00
Antonio Murdaca
a05536ff42 Merge pull request #23412 from vdemeester/migrate-load-and-save-to-cobra
Use spf13/cobra for docker load and save
2016-06-10 12:02:18 +02:00
Vincent Demeester
075b75fa14
Fix some context sharing/plumbing
With cobra switch (and maybe before), some context weren't *plumbed* the
right way, fixing that.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-09 17:58:10 +02:00
Vincent Demeester
6632fd2788
Migrate save command to cobra
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-09 17:38:20 +02:00
Vincent Demeester
8b1d40271f
Migrate load command to cobra
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-09 17:28:33 +02:00
Zhang Wei
c111b7eb3d Move GetExitCode to package container and unexport it
GetExitCode is used only by container package, so move it to package
container and unexport it

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-09 18:04:53 +08:00
Yong Tang
939a142c8d Use spf13/cobra for docker commit
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker commit` to use spf13/cobra

NOTE: `RequiresMinMaxArgs()` has been renamed to `RequiresRangeArgs()`.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-08 19:00:58 -07:00
Vincent Demeester
e884a515e9 Merge pull request #23334 from WeiZhang555/cobra-stats
Migrate stats and events command to cobra
2016-06-08 23:50:46 +02:00
Vincent Demeester
8a22c4166b Merge pull request #23384 from jannickfahlbusch/fix-typos
Fix some typos
2016-06-08 23:46:47 +02:00
Brian Goff
6fd8c96f61 Merge pull request #23344 from pdalpra/timeout-as-time.Duration
Timeout as time.duration
2016-06-08 16:37:08 -04:00
Jannick Fahlbusch
e3490cdcc0 Fix some typos
Signed-off-by: Jannick Fahlbusch <git@jf-projects.de>
2016-06-08 21:59:34 +02:00
Alexander Morozov
3b08711bb7 Merge pull request #23343 from vdemeester/migrate-build-to-cobra
Use spf13/cobra for docker build
2016-06-08 11:59:48 -07:00
Pierre Dal-Pra
b29e8ea412 Use time.Duration for container restart/stop timeouts
Signed-off-by: Pierre Dal-Pra <dalpra.pierre@gmail.com>
2016-06-08 08:05:18 +02:00
Zhang Wei
04cdb8e602 Migrate stats and events command to cobra.
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-08 10:39:53 +08:00
Ben Firshman
322e2a7d05 Return remote API errors as JSON
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-06-07 18:45:27 -07:00
Vincent Demeester
13d101d53c Merge pull request #23333 from yongtang/23211-spf13-cobra-version
Use spf13/cobra for docker version
2016-06-07 23:46:01 +02:00
Brian Goff
ce96ce9e05 Merge pull request #23311 from WeiZhang555/cobra-rm
Migrate rm command to cobra
2016-06-07 17:05:21 -04:00
Sebastiaan van Stijn
6b46a56865
remove fallback for Go 1.4
Windows is now built using Go 1.6, so we no longer
need to have a fallback for Go 1.4.

This removes the fallback that was introduced in
6df3fc5175 /
https://github.com/docker/docker/pull/18553

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-06-07 22:38:02 +02:00
Sebastiaan van Stijn
08419313ec Merge pull request #23292 from yongtang/23211-spf13-cobra-images
Use spf13/cobra for docker images
2016-06-07 21:56:42 +02:00
Sebastiaan van Stijn
55a8bfa0e8 Merge pull request #23278 from yongtang/23211-spf13-cobra-tag
Use spf13/cobra for docker tag
2016-06-07 21:55:29 +02:00
Alexander Morozov
8cd6977f98 Merge pull request #23338 from vdemeester/23253-fix-create-run
Fix create command flags
2016-06-07 10:46:45 -07:00
Vincent Demeester
60f447b655
Migrate docker build to cobra
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-07 18:15:44 +02:00
Yong Tang
ba7324ffcb Use spf13/cobra for docker tag
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker tag` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-07 08:12:49 -07:00
Yong Tang
bc82e51d77 Use spf13/cobra for docker version
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker version` to use spf13/cobra

NOTE: Most of the commands like `run`, `images` etc. goes to packages of
`container`, `image`, `network`, etc. Didn't find a good place for
`docker version` so just use the package `client` for now.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-07 08:11:34 -07:00
Yong Tang
65a0034c67 Use spf13/cobra for docker images
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker images` to use spf13/cobra

NOTE: As part of this fix, a new function `RequiresMaxArgs()`
has been defined in `cli/required.go`. This func returns an
error if there is not at most max args

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-07 08:10:49 -07:00
Zhang Wei
7702f39fe8 Migrate rm command to cobra
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-07 22:19:16 +08:00
Sebastiaan van Stijn
88323c861a Merge pull request #23307 from WeiZhang555/cobra-restart
Migrate restart command to cobra
2016-06-07 15:28:35 +02:00
Vincent Demeester
aa00520fc8
Fix create command flags
Any command that expects extra flags after positional args needs to set flags.SetInterspersed(false).

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-07 14:11:11 +02:00
Sebastiaan van Stijn
4f9e2f9fb4 Merge pull request #23297 from WeiZhang555/cobra-kill
Migrate kill command to cobra
2016-06-07 13:44:22 +02:00
Sebastiaan van Stijn
f061f556f2 Merge pull request #23269 from vdemeester/migrate-import-to-cobra
Use spf13/cobra for docker import
2016-06-07 13:07:30 +02:00
Vincent Demeester
148d2b8e4a Merge pull request #22149 from vdemeester/deprecated-copy-endpoint
Deprecate /containers/(id or name)/copy endpoint
2016-06-07 12:50:04 +02:00
Zhang Wei
732f08a822 Migrate kill command to cobra
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-07 17:20:33 +08:00
Zhang Wei
264462d601 Migrate restart command to cobra
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-07 17:13:53 +08:00
Vincent Demeester
f9021838b6 Merge pull request #23226 from HackToday/fixnetinspectId
Fix the network inspect id
2016-06-07 10:02:17 +02:00
Vincent Demeester
6d4a7213e6 Merge pull request #23285 from yongtang/23211-spf13-cobra-pause
Use spf13/cobra for docker pause
2016-06-07 10:01:42 +02:00
Vincent Demeester
804536df25 Merge pull request #23291 from yongtang/23211-spf13-cobra-history
Use spf13/cobra for docker history
2016-06-07 10:00:39 +02:00
Vincent Demeester
e83dad090a Merge pull request #23290 from yongtang/23211-spf13-cobra-rename
Use spf13/cobra for docker rename
2016-06-07 08:28:27 +02:00
Brian Goff
ab821f9f9b Merge pull request #23274 from WeiZhang555/cobra-attach
Move attach command to cobra
2016-06-06 21:16:45 -04:00
Yong Tang
70f7ccb304 Use spf13/cobra for docker rename
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker rename` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-06 12:39:11 -07:00
Yong Tang
91731706c2 Use spf13/cobra for docker pause
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker pause` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-06 12:37:18 -07:00
Alexander Morozov
5ce2f14f9b Merge pull request #23306 from yongtang/23211-spf13-cobra-top
Use spf13/cobra for docker top
2016-06-06 10:14:10 -07:00
Vincent Demeester
52da20b839 Merge pull request #23286 from yongtang/23211-spf13-cobra-port
Use spf13/cobra for docker port
2016-06-06 18:55:37 +02:00
Kai Qiang Wu(Kennan)
864e362aa0 Fix the network inspect id
This fixes #22231

Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
2016-06-06 15:26:07 +00:00
Yong Tang
a76d387cda Use spf13/cobra for docker history
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker history` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-06 08:03:07 -07:00
Zhang Wei
eceb8625a9 Move attach command to cobra.
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-06 22:28:57 +08:00
Yong Tang
0f38669267 Use spf13/cobra for docker top
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker top` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-06 06:38:43 -07:00
Yong Tang
d5971c230d Use spf13/cobra for docker port
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker port` to use spf13/cobra

Note: As part of this fix, a new function `RequiresMinMaxArgs(min int, max int)`
has been added in cli/required.go. This function restrict the args
to be at least min and at most max.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-06 05:32:34 -07:00
Yong Tang
82f84a67d6 Use spf13/cobra for docker wait
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker wait` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-06 05:09:41 -07:00
Vincent Demeester
7878705dcc
Fix TestDiffEmptyArgClientError O:)
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-06 13:58:29 +02:00
Vincent Demeester
9d2e8abd30
Migrate import command to cobra
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-06 13:58:23 +02:00
Sebastiaan van Stijn
07a7c0632f Merge pull request #23210 from vdemeester/migrate-network-command-to-cobra
Use spf13/cobra for docker network and subcommands
2016-06-06 13:51:57 +02:00
Vincent Demeester
9d449d89f7 Merge pull request #23129 from WeiZhang555/print-detailed-error
Print original error for `start`
2016-06-06 13:43:52 +02:00
Vincent Demeester
4bd202b00f
Migrate network command to cobra
- Migrates network command and subcommands (connect, create, disconnect,
  inspect, list and remove) to spf13/cobra
- Create a RequiredExactArgs helper function for command that require an
  exact number of arguments.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-06 10:28:52 +02:00
Vincent Demeester
731bae6749 Merge pull request #23284 from yongtang/23211-spf13-cobra-logs
Use spf13/cobra for docker logs
2016-06-06 09:06:51 +02:00
Vincent Demeester
2becfab55f Merge pull request #23283 from yongtang/23211-spf13-cobra-diff
Use spf13/cobra for docker diff
2016-06-06 09:05:18 +02:00
Vincent Demeester
c35d9f2611 Merge pull request #23268 from WeiZhang555/cobra-start
Migrate start command to cobra
2016-06-06 08:59:42 +02:00
Zhang Wei
c498d4700d Bug fix: docker run -i --restart always hangs.
e.g.
```
$ docker run -i --restart always busybox sh
pwd
/
exit 11

<...hang...>
```

This is because Attach(daemon side) and Run(client side) both hangs on
WaitStop, if container is restarted too quickly, wait won't have chance
to get exit signal.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-06 10:16:07 +08:00
Zhang Wei
b4740e3021 Log and print original error for start
Currently `start` will hide some errors and throw a consolidated error,
which will make it hard to debug because developer can't find the
original error.

This commit allow daemon to log original errors first.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-06 10:13:49 +08:00
Zhang Wei
4f3625a288 Migrate start command to cobra
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-06-06 09:53:18 +08:00
Yong Tang
8ea7733a63 Use spf13/cobra for docker unpause
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker unpause` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-05 17:29:52 -07:00
Yong Tang
4f4b59cc43 Use spf13/cobra for docker logs
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker logs` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-05 15:51:35 -07:00
Alexander Morozov
e94be2f639 Merge pull request #23242 from vdemeester/migrate-rmi-to-cobra
Use spf13/cobra for docker rmi
2016-06-05 15:29:01 -07:00
Yong Tang
5899afae52 Use spf13/cobra for docker diff
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker diff` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-05 15:13:55 -07:00
Vincent Demeester
60e48bd6bd
Use spf13/cobra for docker rmi
Moves image command rmi to `api/client/image/remove.go` and use cobra :)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-05 22:40:35 +02:00
Brian Goff
1a1083ae75 Merge pull request #23247 from thaJeztah/carry-22033-docker-ps-format-output
[Carry 22033] Add a check for size field in custom format string
2016-06-05 16:39:22 -04:00
Vincent Demeester
b259558336 Merge pull request #23276 from yongtang/23211-spf13-cobra-stop
Use spf13/cobra for docker stop
2016-06-05 22:37:15 +02:00
Sebastiaan van Stijn
c764234c3b Merge pull request #23267 from vdemeester/migrate-export-to-cobra
Use spf13/cobra for docker export
2016-06-05 20:05:51 +02:00
Yong Tang
63d66d2796 Use spf13/cobra for docker stop
This fix is part of the effort to convert commands to spf13/cobra #23211.

Thif fix coverted command `docker stop` to use spf13/cobra

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-05 10:25:21 -07:00
Vincent Demeester
372063ce1b
Deprecated the old 3-args form of docker import
It's been deprecated since November 2013 and v0.6.7. Removing the cli
side of it.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-05 18:07:34 +02:00
Vincent Demeester
b25e64183c
Migrate export command to cobra
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-05 16:42:19 +02:00
Daniel Nephin
5ab2434225 Convert 'docker create' to use cobra and pflag
Return the correct status code on flag parsins errors.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-04 13:57:30 +02:00
Daniel Nephin
a77f2450c7 Convert 'docker run' to a cobra command and to use pflags
Move container options into a struct so that tests should pass.
Remove unused FlagSet arg from Parse
Disable interspersed args on docker run

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-04 13:55:35 +02:00
Paulo Ribeiro
55cdb6dcd0
Add a check for size field in custom format string
This fix addresses an issue where including the `{{.Size}}` format
field in conjunction with `docker ps --format`, without the `--size`
flag, would not correctly display the size of containers.

This is done by doing a check on the custom format string, and setting
the size flag on the options struct if the field is found. This struct
gets passed to the engine API which then generates the correct query.

An integration test is included which runs `docker ps --format "table
{{.Size}}"` without `--size`, and checks that the returned output is
not `0 B`.

Fixes #21991

As suggested by @cpuguy83, a parser is implemented to process the format
string as a template, and then traverses the template tree to determine
if `.Size` was called.

This was then reworked by making use of template execution with a
pre-processor struct that will set the `--size` option if the template
calls for the field.

The pre-processor now also sets a boolean in the context passed to the
writer. There is an integration test for this that calls `docker ps
--size --format "{{.Size}}"` and then checks that `size: {{.Size}}` is
not appended, as it would with previous behavior.

Finally, a change was made to the formatter to not automatically
add a `{{.Size}}` if a custom format is provided.

Signed-off-by: Paulo Ribeiro <paigr.io@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-06-03 21:59:10 +02:00
Vincent Demeester
a11ef10631
Use spf13/cobra for docker search
- Move image command search to `api/client/image/search.go`
- Use cobra :)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-03 19:50:01 +02:00
Vincent Demeester
428328908d
Deprecate /containers/(id or name)/copy endpoint
This endpoint has been deprecated since 1.8. Return an error starting
from this API version (1.24) in order to make sure it's not used for the
next API version and so that we can remove it some times later.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-03 19:38:03 +02:00
Sebastiaan van Stijn
020a86b3d9 Merge pull request #23107 from yongtang/23055-docker-search-limit
Add `--limit` option to `docker search`
2016-06-03 14:25:42 +02:00
Sebastiaan van Stijn
766550385d Merge pull request #22715 from allencloud/add-trace-http-pprof
add trace in docker engine's pprof to show execution trace in binary form
2016-06-03 13:22:13 +02:00
Yong Tang
92f10fe228 Add --limit option to docker search
This fix tries to address the issue raised in #23055.
Currently `docker search` result caps at 25 and there is
no way to allow getting more results (if exist).

This fix adds the flag `--limit` so that it is possible
to return more results from the `docker search`.

Related documentation has been updated.

Additional tests have been added to cover the changes.

This fix fixes #23055.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-02 19:12:20 -07:00
Sven Dowideit
98c245c9e6 Merge pull request #23193 from allencloud/fix-typos
use grep to find all a/an typos
2016-06-02 18:45:08 -07:00
Thomas Leonard
b6c7becbfe
Add support for user-defined healthchecks
This PR adds support for user-defined health-check probes for Docker
containers. It adds a `HEALTHCHECK` instruction to the Dockerfile syntax plus
some corresponding "docker run" options. It can be used with a restart policy
to automatically restart a container if the check fails.

The `HEALTHCHECK` instruction has two forms:

* `HEALTHCHECK [OPTIONS] CMD command` (check container health by running a command inside the container)
* `HEALTHCHECK NONE` (disable any healthcheck inherited from the base image)

The `HEALTHCHECK` instruction tells Docker how to test a container to check that
it is still working. This can detect cases such as a web server that is stuck in
an infinite loop and unable to handle new connections, even though the server
process is still running.

When a container has a healthcheck specified, it has a _health status_ in
addition to its normal status. This status is initially `starting`. Whenever a
health check passes, it becomes `healthy` (whatever state it was previously in).
After a certain number of consecutive failures, it becomes `unhealthy`.

The options that can appear before `CMD` are:

* `--interval=DURATION` (default: `30s`)
* `--timeout=DURATION` (default: `30s`)
* `--retries=N` (default: `1`)

The health check will first run **interval** seconds after the container is
started, and then again **interval** seconds after each previous check completes.

If a single run of the check takes longer than **timeout** seconds then the check
is considered to have failed.

It takes **retries** consecutive failures of the health check for the container
to be considered `unhealthy`.

There can only be one `HEALTHCHECK` instruction in a Dockerfile. If you list
more than one then only the last `HEALTHCHECK` will take effect.

The command after the `CMD` keyword can be either a shell command (e.g. `HEALTHCHECK
CMD /bin/check-running`) or an _exec_ array (as with other Dockerfile commands;
see e.g. `ENTRYPOINT` for details).

The command's exit status indicates the health status of the container.
The possible values are:

- 0: success - the container is healthy and ready for use
- 1: unhealthy - the container is not working correctly
- 2: starting - the container is not ready for use yet, but is working correctly

If the probe returns 2 ("starting") when the container has already moved out of the
"starting" state then it is treated as "unhealthy" instead.

For example, to check every five minutes or so that a web-server is able to
serve the site's main page within three seconds:

    HEALTHCHECK --interval=5m --timeout=3s \
      CMD curl -f http://localhost/ || exit 1

To help debug failing probes, any output text (UTF-8 encoded) that the command writes
on stdout or stderr will be stored in the health status and can be queried with
`docker inspect`. Such output should be kept short (only the first 4096 bytes
are stored currently).

When the health status of a container changes, a `health_status` event is
generated with the new status. The health status is also displayed in the
`docker ps` output.

Signed-off-by: Thomas Leonard <thomas.leonard@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-06-02 23:58:34 +02:00
Vincent Demeester
6b7f12650d
Update ContainerStart calls to use options now
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-02 16:56:13 +02:00