Commit graph

921 commits

Author SHA1 Message Date
Aaron Lehmann
e7c39f4d5d api: Remove SecretRequestOption type
This type is only used by CLI code. It duplicates SecretReference in the
types/swarm package. Change the CLI code to use that type instead.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-16 11:20:31 -07:00
Daniel Nephin
576d2181e4 Fix compose schema id for v3.2
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-16 13:53:58 -04:00
Pure White
1d61f11e34 fix a typo
when i was using:
docker search --automated -s 3 nginx
told me:
Flag --automated has been deprecated, use --filter=automated=true instead
Flag --stars has been deprecated, use --filter=stars=3 instead
and when i use:
docker search --filter=automated=true --filter=stars=3 nginx
told me:
Error response from daemon: Invalid filter 'automated'
and i found out that the correct command should be:
docker search --filter=is-automated=true --filter=stars=3 nginx

Signed-off-by: Pure White <daniel48@126.com>
2017-03-16 23:11:57 +08:00
Sebastiaan van Stijn
e638089622 Add missing API version annotations to commands
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-03-16 13:40:12 +01:00
Vincent Demeester
52143aee95 Merge pull request #31775 from erxian/misleading-default-for-update-monitor-duration-flag
misleading default for --update-monitor duration
2017-03-16 10:13:26 +01:00
Vincent Demeester
8316753f96 Merge pull request #31866 from gdevillele/pr_service_create
improve semantics of utility function in cli/command/service
2017-03-16 10:12:15 +01:00
Akihiro Suda
87c5f67cfa Merge pull request #31057 from krasi-georgiev/30779-fix-client-login-credentials-save-domain
fix incorect login client credential save when the registry is the default docker registry
2017-03-16 13:19:32 +09:00
Gaetan de Villele
1526a99672 improve semantics of utility function in cli/command/service
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
2017-03-15 13:49:52 -07:00
Victor Vieux
4bce232139 Revert "Planned 1.13 deprecation: email from login"
This reverts commit a66efbddb8.

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-03-15 10:43:18 -07:00
Sebastiaan van Stijn
b0d1936d30 Merge pull request #31302 from dnephin/purge-orphaned-services
Add --prune to stack deploy
2017-03-15 12:57:06 +01:00
erxian
3e6ff87f69 misleading default for --update-monitor duration
Signed-off-by: erxian <evelynhsu21@gmail.com>
2017-03-15 14:20:02 +08:00
Anusha Ragunathan
95b46ff68f Merge pull request #31147 from adshmh/30629-print-escaping-hint-on-invalid-interpolation-format
docker stack deploy interpolation format error due to not escaping $ now includes a hint
2017-03-14 17:14:09 -07:00
Daniel Nephin
644fd804fc Add --prune to stack deploy.
Add to command line reference.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-14 16:09:28 -04:00
Daniel Nephin
a9c86b63c0 Fix environment resolving.
Load from env should only happen if the value is unset.
Extract a buildEnvironment function and revert some changes to tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-14 16:00:43 -04:00
Akihiro Suda
ea43c33330 compose: fix environment interpolation from the client
For an environment variable defined in the yaml without value,
the value needs to be propagated from the client, as in Docker Compose.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-03-14 15:59:40 -04:00
Victor Vieux
1a24abe42d Merge pull request #31809 from vieux/bump_api
bump API to 1.28
2017-03-14 11:53:52 -07:00
Daniel Nephin
cd56476f18 Merge pull request #31795 from dnephin/compose-file-v3.2
Compose file v3.2
2017-03-14 14:10:24 -04:00
Justin Cormack
49376cddab Merge pull request #30597 from dnephin/add-expanded-mount-format-to-stack-deploy
Add expanded mount format to stack deploy
2017-03-14 17:53:28 +00:00
Victor Vieux
cd173a6030 bump API to 1.28
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-03-14 09:32:50 -07:00
Vincent Demeester
1d4608032d Merge pull request #31500 from dperny/fix-service-logs-cli
Add tail and since to service logs
2017-03-14 14:19:29 +01:00
Madhu Venugopal
cdf66ba715 Merge pull request #31710 from sanimej/drillerrr
Add verbose flag to network inspect to show all services & tasks in swarm mode
2017-03-13 21:12:32 -07:00
Santhosh Manohar
14f76a21db Enhance network inspect to show all tasks, local & non-local, in swarm mode
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2017-03-13 17:52:08 -07:00
Brian Goff
aa733ba8a8 Merge pull request #31672 from dperny/service-logs-formatting
Service logs formatting
2017-03-13 19:08:55 -04:00
Daniel Nephin
e7bf5be18b Add compose file version 3.2
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-13 16:20:42 -04:00
Daniel Nephin
6a21a127ab Refactor container run cli command.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-13 16:05:51 -04:00
Daniel Nephin
751552c65f Move endpoint_mode under deploy and add it to the schema.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-13 15:00:56 -04:00
allencloud
9679065728 support both endpoint modes in stack
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-03-13 15:00:49 -04:00
Justin Cormack
2c6a1e1878 Merge pull request #31579 from ijc25/cpuacct
Correct CPU usage calculation in presence of offline CPUs and newer Linux
2017-03-13 16:32:18 +00:00
Vincent Demeester
be453c5a13 Merge pull request #30788 from ripcurld0/hide_win_opts
Hide command options that are related to Windows
2017-03-13 16:15:29 +01:00
Sebastiaan van Stijn
562d2dc978 Merge pull request #30648 from allencloud/do-not-fail-fast-when-inspect
do not fail fast when executing inspect command
2017-03-13 16:04:04 +01:00
Boaz Shuster
7199522ea2 Hide command options that are related to Windows
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2017-03-12 08:47:17 +02:00
Jeremy Chambers
6bc1f345af Implements --format option for docker history command by creating a formatter
Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Adds to history documentation for --format

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Adds MarshalJSON to historyContext for {{json .}} format

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Adds back the --human option to history command

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Cleans up formatter around --human option for history, Adds integration test for --format option of history

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Adds test for history formatter checking full table results, Runs go fmt on touched files

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Fixes lint errors in formatter/history

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

Runs go fmt on cli/command/formatter/history.go

Signed-off-by: Jeremy Chambers <jeremy@thehipbot.com>

sRemoves integration test for --format option of history

Merges Created and CreatedSince in docker history formatter, Updates docs and tests
2017-03-11 13:54:16 -06:00
Sebastiaan van Stijn
8b02a15d52 Merge pull request #31176 from adshmh/29662-stack-deploy-error-if-external-combined-with-other-volume-options
stack deploy exits with error if both 'external' and other options are specified for a volume
2017-03-11 01:59:43 +01:00
Tibor Vass
e10f9db26d Merge pull request #30047 from duglin/distError
Add the mediaType to the error
2017-03-10 16:44:49 -08:00
Drew Erny
8dc437bd9b Add tail and since to service logs
This change adds the ability to do --tail and --since on docker service
logs. It wires up the API endpoints to each other and fixes some older
bugs. It adds integration tests for these new features.

Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-03-10 14:59:00 -08:00
Vincent Demeester
83e29a5d87 Merge pull request #31582 from dnephin/misc-flag-cleanup
Cleanup some memory flags used in the CLI
2017-03-10 14:16:42 +01:00
Ian Campbell
115f91d757 Correct CPU usage calculation in presence of offline CPUs and newer Linux
In https://github.com/torvalds/linux/commit/5ca3726 (released in v4.7-rc1) the
content of the `cpuacct.usage_percpu` file in sysfs was changed to include both
online and offline cpus. This broke the arithmetic in the stats helpers used by
`docker stats`, since it was using the length of the PerCPUUsage array as a
proxy for the number of online CPUs.

Add current number of online CPUs to types.StatsJSON and use it in the
calculation.

Keep a fallback to `len(v.CPUStats.CPUUsage.PercpuUsage)` so this code
continues to work when talking to an older daemon. An old client talking to a
new daemon will ignore the new field and behave as before.

Fixes #28941.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-03-10 10:24:33 +00:00
allencloud
fb1f22b06a do not fail fast when executing inspect command
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-03-10 16:09:09 +08:00
Ying Li
bf7766bfe8 Use either the system root pool or an empty cert pool with custom CA roots,
and not a joint system+custom CA roots pool, when connecting from a docker
client to a remote daemon.

Signed-off-by: Ying Li <ying.li@docker.com>
2017-03-09 11:19:20 -08:00
Harald Albers
b303e229ca Fix description of docker run|create --stop-signal in help message
Signed-off-by: Harald Albers <github@albersweb.de>
2017-03-09 09:32:16 +01:00
Drew Erny
83c34de515 Fixed concerns, updated, and rebased PR.
Signed-off-by: Drew Erny <drew.erny@docker.com>
2017-03-08 16:35:58 -08:00
Andrea Luzzardi
70a4369f5e service logs: Improve formatting
- Align output. Previously, output would end up unaligned because of
longer task names (e.g. web.1 vs web.10)
- Truncate task IDs and add a --no-trunc option
- Added a --no-ids option to remove IDs altogether
- Got rid of the generic ID Resolver as we need more customization.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2017-03-08 14:08:04 -08:00
Sebastiaan van Stijn
fb024df8f0 Merge pull request #31443 from james-nesbitt/export-more-compose-methods
exported add. cli compose loader parsing methods
2017-03-08 15:12:42 +01:00
Brian Goff
dd221a1e17 Merge pull request #31258 from dnephin/fix-override-default-stack-network
Support customizing the default network for a stack
2017-03-07 14:28:16 -05:00
Arash Deshmeh
96039b394a stack deploy exits with error if both 'external' and any other options are specified for volumes
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-03-07 14:21:45 -05:00
James Nesbitt
a1560a0cf2 exported cli compose loader parsing methods
Signed-off-by: James Nesbitt <james.nesbitt@wunderkraut.com>
2017-03-07 17:36:35 +02:00
Daniel Nephin
afcaeedbd4 Use opts.MemBytes for flags.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-07 10:32:49 -05:00
Daniel Nephin
2e9f9d2c34 Some things just need to be line wrapped.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-06 16:01:57 -05:00
Daniel Nephin
a1bbb2f7ea Convert new compose volume type to swarm mount type
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-06 11:45:01 -05:00
Daniel Nephin
190dc5a40a Support expanded mounts in Compose loader
Add a test for loading expanded mount format.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-06 11:45:01 -05:00
Daniel Nephin
32c955b8fe Parse a volume spec on the client, with support for windows drives
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-06 11:45:01 -05:00
Daniel Nephin
65c899bee5 Add expanded mount syntax to Compose schema and types.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-06 11:45:01 -05:00
Sebastiaan van Stijn
3cfc3e30a8 Merge pull request #31543 from chawlanikhil24/master
Replaced "err" with  "nil" & added a comment
2017-03-06 15:11:14 +01:00
Nikhil Chawla
73309aa009 Fixed the typo in the code
Signed-off-by: Nikhil Chawla <chawlanikhil24@gmail.com>
2017-03-06 17:31:04 +05:30
Aaron Lehmann
f9bd8ec8b2 Implement server-side rollback, for daemon versions that support this
Server-side rollback can take advantage of the rollback-specific update
parameters, instead of being treated as a normal update that happens to
go back to a previous version of the spec.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-03 16:33:34 -08:00
Aaron Lehmann
3a88a24d23 Add support for rollback flags
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-03 16:33:34 -08:00
Aaron Lehmann
cc9d04647a Add support for the "rollback" failure action
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-03-03 16:33:34 -08:00
Yong Tang
f2197b6794 Fix error caused by overlapping merge of 30733
This fix fixes build error caused by overlapping merge of 30733 and 28213.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-03-03 13:26:00 -08:00
Kenfe-Mickaël Laventure
9369acc776 Merge pull request #30733 from yongtang/02022017-formatter-header
Allow `--format` to use different delim in `table` format
2017-03-03 11:25:19 -08:00
Sebastiaan van Stijn
3a5a1c3f3d Merge pull request #30725 from aaronlehmann/topology
Topology-aware scheduling
2017-03-03 15:01:12 +01:00
Brian Goff
55b955d9ff Merge pull request #31409 from yuexiao-wang/fix-version
'docker daemon' deprecation message doesn't use the new version
2017-03-02 22:02:09 -05:00
yuexiao-wang
5a9cee7bb5 'docker daemon' deprecation message doesn't use the new versioning scheme
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2017-03-03 17:26:49 +08:00
Sebastiaan van Stijn
bb9f19503c Merge pull request #30754 from yongtang/25696-stop-signal
Add `--stop-signal` for `service create` and `service update`
2017-03-01 18:10:57 +01:00
Sebastiaan van Stijn
822abee151 Merge pull request #31124 from vdemeester/volume-unit-tests
Add unit tests to cli/command/volume package
2017-03-01 14:13:47 +01:00
Doug Davis
c127d9614f Add the mediaType to the error
Without this fix the error the client might see is:
	target is unknown
which wasn't helpful to me when I saw this today. With this fix I
now see:
	MediaType is unknown: 'text/html'
which helped me track down the issue to the registry I was talking to.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2017-02-28 11:36:32 -08:00
Vincent Demeester
38d985a1c1 Merge pull request #31290 from thaJeztah/print-d_type_warning
add d_type warning to docker info, and optimize output
2017-02-28 16:35:00 +01:00
Aaron Lehmann
17288c611a Topology-aware scheduling
This adds support for placement preferences in Swarm services.

- Convert PlacementPreferences between GRPC API and HTTP API
- Add --placement-pref, --placement-pref-add and --placement-pref-rm to CLI
- Add support for placement preferences in service inspect --pretty
- Add integration test

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2017-02-27 13:29:54 -08:00
Vincent Demeester
6da111b3bb
Add unit tests to cli/command/volume package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-27 18:39:35 +01:00
Sebastiaan van Stijn
a64ea37753 Merge pull request #30383 from TDAbboud/30096-add-host-docker-build
Add --add-host for docker build
2017-02-27 12:42:18 +01:00
Akihiro Suda
a6576b8a2b Merge pull request #31212 from fate-grand-order/fixed
use t.Fatal() to output the err message and fix typo
2017-02-27 12:26:35 +09:00
Genki Takiuchi
d654c3d831 Fixed typo.
Signed-off-by: Genki Takiuchi <genki@s21g.com>
2017-02-26 12:59:18 +09:00
Daniel Nephin
b7577dd2ad Support customizing the default network for a stack.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-02-24 17:32:23 -05:00
Arash Deshmeh
6d2a7eebcb docker compose interpolation format error now includes a hint on escaping $ characters.
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-02-24 11:37:40 -05:00
Sebastiaan van Stijn
1921559798
add d_type warning to docker info, and optimize output
The overlay(2) drivers were moved up in the list of storage drivers,
and are known to have problems if the backing filesystem does not
support d_type.

Commit 2e20e63da2 added a warning,
which is logged in the daemon logs, however, many users do not
check those logs, and may overlook this warning.

This patch adds the same warning to the output of `docker info`
so that the warning is more easily found.

In addition, the output of warnings printed by `docker info` is
optimized, by;

- moving all warnings to the _end_ of the output, instead of
  mixing them with the regular output
- wrapping the storage-driver warnings, so that they are more
  easily readable

Example output with this patch applied
============================================

devicemapper using loopback devices:

    ...
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false

    WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.
             Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
    WARNING: bridge-nf-call-iptables is disabled
    WARNING: bridge-nf-call-ip6tables is disabled

overlay2 on xfs without d_type support;

    ...
    Insecure Registries:
     127.0.0.0/8
    Live Restore Enabled: false

    WARNING: overlay2: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior.
             Reformat the filesystem with ftype=1 to enable d_type support.
             Running without d_type support will not be supported in future releases.
    WARNING: bridge-nf-call-iptables is disabled

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-02-23 13:36:57 +01:00
yupengzte
ec95ad7353 Delete dots to align with other commands description
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-02-23 16:46:08 +08:00
fate-grand-order
2a8d6368d4 use t.Fatal() to output the err message where the values used for formatting
text does not appear to contain a placeholder

Signed-off-by: Helen Xie <chenjg@harmonycloud.cn>
2017-02-23 10:16:22 +08:00
Yong Tang
c2d49ec214 Add --stop-signal for service create and service update
This fix tries to address the issue raised in 25696 where
it was not possible to specify `--stop-signal` for `docker service create`
and `docker service update`, in order to use special signal to stop
the container.

This fix adds `--stop-signal` and update the `StopSignal` in `Config`
through `service create` and `service update`.

Related docs has been updated.

Integration test has been added.

This fix fixes 25696.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-21 15:19:45 -08:00
Victor Vieux
19795b934c Merge pull request #31206 from xuzhenglun/master
fix wrong print format
2017-02-21 14:13:32 -08:00
Krasi Georgiev
2914098996 ignore registry url from user when it is the default namespace
Signed-off-by: Krasi Georgiev <krasi@vip-consult.solutions>
2017-02-21 22:04:54 +02:00
Reficul
9b1ceecd8a
fix wrong print format
Signed-off-by: Reficul <xuzhenglun@gmail.com>
2017-02-21 10:26:06 +08:00
Sebastiaan van Stijn
25500d56a5 Merge pull request #30814 from YuPengZTE/devSwarmCliExplain
fix the type
2017-02-21 00:59:58 +01:00
Tony Abboud
7a962e4577 Add --add-host for docker build
Signed-off-by: Tony Abboud <tdabboud@hotmail.com>
2017-02-20 17:32:28 -05:00
Victor Vieux
a7e6d2ca1f add missing API changes
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-02-19 01:33:43 -08:00
Anusha Ragunathan
b1debf1374 Merge pull request #28213 from yongtang/11062016-service-ps-format
Add `--format` to `docker service ps`
2017-02-17 10:23:18 -08:00
Alexander Morozov
f00514a1d0 Merge pull request #31114 from allencloud/split-compose-stack-deploy-from-deploydotgo
split compose deploy from deploy.go
2017-02-17 08:48:51 -08:00
Vincent Demeester
40532143c2 Merge pull request #30848 from nishanttotla/suppress-digest-docker-ps
Suppressing image digest in docker ps
2017-02-17 10:27:49 +01:00
allencloud
f46a14f7b6 split compose deploy from deploy.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-02-17 17:13:31 +08:00
Brian Goff
8e57694452 Merge pull request #31088 from xulike666/make-code-readable-again
Typo fixed and this time I provide my cSpell.json
2017-02-16 22:04:27 -05:00
Nishant Totla
b04536f61f
Suppressing image digest in docker ps
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
2017-02-16 18:11:56 -08:00
Brian Goff
a12454d7a9 Merge pull request #31006 from vdemeester/30991-secret-mode-in-stack-deploy
Set 0444 as default secret mode in stack deploy
2017-02-16 20:34:21 -05:00
Aaron.L.Xu
f8a4047796 why there are so many mistakes in our repo (up to /cmd)
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-02-17 00:32:48 +08:00
Vincent Demeester
97d85127c2
Sort docker stack ls by name
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-16 14:30:39 +01:00
Vincent Demeester
f2b68c6cc1
Set 0444 as default secret mode in stack deploy
Change the default secret mode to match the default one used in
`service` subcommands.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-16 11:26:05 +01:00
Alexander Morozov
f18bc25fa1 Merge pull request #29819 from vdemeester/service-validate-publish-simple-syntax
Make sure we validate simple syntax on service commands
2017-02-15 12:31:46 -08:00
bingshen.wbs
4fe611958c fix docker stack volume's nocopy parameter
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
2017-02-15 19:46:27 +08:00
yupengzte
d735972d31 fix the type
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-02-14 09:54:27 +08:00
Vincent Demeester
c110abfa9f Merge pull request #30900 from YuPengZTE/devPublisedPort
Add "=" before the value of PublishedPort
2017-02-12 21:56:43 +01:00
Sebastiaan van Stijn
e5066ef666 Merge pull request #30476 from yongtang/30447-port-config-long-syntax
Support expanded syntax of ports in `docker stack deploy`
2017-02-11 11:13:54 -08:00
Yong Tang
8b165cad1a Ignore some functions in the Go template when header is rendered
This fix ignore some functions in the Go template when header is
redendered, so that `--format "{{truncate .ID 1}}"` will still
be able to redener the header correctly.

Additional test cases have been added to the unit test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-10 19:34:50 -08:00
Yong Tang
ea61dac9e6 Allow --format to use different delim in table format
This fix is an attempt to address
https://github.com/docker/docker/pull/28213#issuecomment-273840405

Currently when specify table format with table `--format "table {{.ID}}..."`,
the delimiter in the header section of the table is always `"\t"`.
That is actually different from the content of the table as the delimiter
could be anything (or even contatenated with `.`, for example):
```
$ docker service ps web --format 'table {{.Name}}.{{.ID}}' --no-trunc

NAME                ID
web.1.inyhxhvjcijl0hdbu8lgrwwh7
 \_ web.1.p9m4kx2srjqmfms4igam0uqlb
```

This fix is an attampt to address the skewness of the table when delimiter
is not `"\t"`.

The basic idea is that, when header consists of `table` key, the header section
will be redendered the same way as content section. A map mapping each
placeholder name to the HEADER entry name is used for the context of the header.

Unit tests have been updated and added to cover the changes.

This fix is related to #28313.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-10 19:34:50 -08:00
Yong Tang
f8c7c921d9 Add --format to docker service ps
This fix tries to address the issue raised in 27189 where
it is not possible to support configured formatting stored in
config.json.

Since `--format` was not supported in `docker service ps`,
the flag `--format` has also been added in this fix.

This fix
1. Add `--format` to `docker service ps`
2. Add `tasksFormat` to config.json
3. Add `--format` to `docker stack ps`
4. Add `--format` to `docker node ps`

The related docs has been updated.

An integration test has been added.

This fix fixes 27189.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-10 16:53:04 -08:00
yupengzte
e9a85c5909 Add = before the value of PublishedPort
Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
2017-02-10 14:53:18 +08:00
Victor Vieux
18adec5c89 print 'worker' join token after swarm init
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-02-09 14:54:05 -08:00
Alexander Morozov
f5116c6802 Merge pull request #30776 from WeiZhang555/stats-all-format-name-panic-cli
Fix panic of "docker stats --format {{.Name}} --all"
2017-02-08 11:40:06 -08:00
Zhang Wei
5a7b3c78e0 Fix panic of "docker stats --format {{.Name}} --all"
This commit fixes panic when execute stats command:

* use --format {{.Name}} with --all when there're exited containers.
* use --format {{.Name}} while stating exited container.

The root cause is when stating an exited container, the result from the
api didn't contain the Name and ID field, which will make format
process panic.

Panic log is like this:

```
panic: runtime error: slice bounds out of range [recovered]
	panic: runtime error: slice bounds out of range

goroutine 1 [running]:
panic(0xb20f80, 0xc420014110)
	/usr/local/go/src/runtime/panic.go:500 +0x1a1
text/template.errRecover(0xc4201773e8)
	/usr/local/go/src/text/template/exec.go:140 +0x2ad
panic(0xb20f80, 0xc420014110)
	/usr/local/go/src/runtime/panic.go:458 +0x243
github.com/docker/docker/cli/command/formatter.(*containerStatsContext).Name(0xc420430160,
0x0, 0x0)
	/go/src/github.com/docker/docker/cli/command/formatter/stats.go:148
+0x86
reflect.Value.call(0xb9a3a0, 0xc420430160, 0x2213, 0xbe3657, 0x4,
0x11bc9f8, 0x0, 0x0, 0x4d75b3, 0x1198940, ...)
	/usr/local/go/src/reflect/value.go:434 +0x5c8
reflect.Value.Call(0xb9a3a0, 0xc420430160, 0x2213, 0x11bc9f8, 0x0, 0x0,
0xc420424028, 0xb, 0xb)
	/usr/local/go/src/reflect/value.go:302 +0xa4
text/template.(*state).evalCall(0xc420177368, 0xb9a3a0, 0xc420430160,
0x16, 0xb9a3a0, 0xc420430160, 0x2213, 0x1178fa0, 0xc4203ea330,
0xc4203de283, ...)
	/usr/local/go/src/text/template/exec.go:658 +0x530
```

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2017-02-08 10:26:52 +08:00
Akihiro Suda
31f172bdb5 Merge pull request #30790 from vdemeester/pr-30602
Carry #30602 : Bump go-units
2017-02-08 11:04:22 +09:00
Vincent Demeester
254fc83cba Merge pull request #30457 from dmcgowan/distribution-reference-update-2
reference: use distribution reference and remove fork
2017-02-07 22:01:25 +01:00
Vincent Demeester
cb89d658dc
Bump go-units
To include  https://github.com/docker/go-units/pull/23
Fixes a unit test that fails because of it.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-07 21:58:56 +01:00
Derek McGowan
3a1279393f
Use distribution reference
Remove forked reference package. Use normalized named values
everywhere and familiar functions to convert back to familiar
strings for UX and storage compatibility.

Enforce that the source repository in the distribution metadata
is always a normalized string, ignore invalid values which are not.
Update distribution tests to use normalized values.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-07 11:08:37 -08:00
Yong Tang
f07a28a541 Support expanded ports in Compose loader
This commit adds support for expanded ports in Compose loader,
and add several unit tests for loading expanded port format.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-07 09:14:56 -08:00
Yong Tang
60c1eaf8f0 Add expanded port syntax to Compose schema and types.
This commit adds expanded port syntax to Compose schema and types
so that it is possible to have
```
ports:
  - mode: host
    target: 80
    published: 9005
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-07 09:12:55 -08:00
Vincent Demeester
aa4ecd153b
Make sure we validate simple syntax on service commands
We ignored errors for simple syntax in `PortOpt` (missed that in the
previous migration of this code). This make sure we don't ignore
`nat.Parse` errors.

Test has been migrate too (errors are not exactly the same as before
though -_-)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-02-07 12:45:47 +01:00
Alexander Morozov
90709776c5 Merge pull request #30749 from yongtang/28005-docker-stats-header-windows
Fix Windows `docker stats` showing Linux headers
2017-02-06 14:09:23 -08:00
Alexander Morozov
e06ae6f419 Merge pull request #30742 from yongtang/29975-compose-network-attachable
Add compose support of `attachable` in networks
2017-02-06 12:27:44 -08:00
Alexander Morozov
d4136eb525 Merge pull request #30769 from tianon/prompt-for-confirmation
Fix "command.PromptForConfirmation" to accept "enter" for the "N" default
2017-02-06 11:44:45 -08:00
Tianon Gravi
2198b0568f Fix "command.PromptForConfirmation" to accept "enter" for the "N" default
This adjusts `command.PromptForConfirmation` in `cli/command/utils.go` to use `bufio`'s `ReadLine` rather than using `fmt.Fscan` for reading input, which makes `<Enter>` properly accept the default value of "No" as one would expect.

This new code actually came from `cli/command/plugin/install.go`'s `acceptPrivileges` function, which I've also refactored here to use `command.PromptForConfirmation` as it should.

Additionally, this updates `cli/command/plugin/upgrade.go`'s `runUpgrade` function to use `command.PromptForConfirmation` for further consistency.

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2017-02-06 09:13:07 -08:00
Yong Tang
0a3a3ba2b6 Fix Windows docker stats showing Linux headers
This fix is an attempt to fix issue raised in #28005 where
`docker stats` on Windows shows Linux headers if there is
no containers in stats.

The reason for the issue is that, in case there is no container,
a header is faked in:
https://github.com/docker/docker/blob/v1.13.0/cli/command/formatter/formatter.go#L74-L78
which does not know OS type information (as OS was stored with container stat entries)

This fix tries to fix the issue by moving OS type information
to stats context (instead of individual container stats entry).

Additional unit tests have been added.

This fix fixes #28005.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-05 08:55:30 -08:00
Yong Tang
cf4b7a5b87 Add compose support of attachable in networks
This fix tries to address the issue raised in 29975 where
it was not possible to specify `attachable` flag for networks
in compose format.

NOTE: Compose format aleady supports `labels` in networks.

This fix adds the support of `attachable` for compose v3.1 format.

Additiona unit tests have been updated and added.

This fix fixes 29975.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-04 14:16:06 -08:00
Sebastiaan van Stijn
fac13e4e07 Merge pull request #28751 from ijc25/wrap-help-output
Wrap CLI --help output to terminal width
2017-02-03 23:04:11 -08:00
Brian Goff
03c6949739 Add docker plugin upgrade
This allows a plugin to be upgraded without requiring to
uninstall/reinstall a plugin.
Since plugin resources (e.g. volumes) are tied to a plugin ID, this is
important to ensure resources aren't lost.

The plugin must be disabled while upgrading (errors out if enabled).
This does not add any convenience flags for automatically
disabling/re-enabling the plugin during before/after upgrade.

Since an upgrade may change requested permissions, the user is required
to accept permissions just like `docker plugin install`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-02-03 16:21:12 -05:00
Ian Campbell
a4f71ccff6 Wrap output of docker cli --help
This should go some way to unblocking a solution to #18797, #18385 etc by
removing the current rather restrictive constraints on help text length.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-02-03 11:05:49 +00:00
Sebastiaan van Stijn
e07c392c49 Merge pull request #30180 from allencloud/add-endpoint-mode-a-default-value
add endpoint mode a default value
2017-02-02 11:51:44 -08:00
Vincent Demeester
4ca00c09b6 Merge pull request #28199 from yongtang/11062016-service-ls-format
Add `--format` to `docker service ls`
2017-02-02 10:40:04 +01:00
Brian Goff
bb0a532fc2 Merge pull request #30203 from allencloud/validate-healthcheck-params-in-daemon-side
validate healthcheck params in daemon side
2017-02-01 21:19:30 -05:00
Vincent Demeester
3c64061b67 Merge pull request #29747 from xlgao-zju/break-the-for
exit collect when we get EOF
2017-02-01 22:29:18 +01:00
Yong Tang
000f0403d9 Add --format to docker service ls
This fix tries to improve the display of `docker service ls`
and adds `--format` flag to `docker service ls`.

In addition to `--format` flag, several other improvement:
1. Updates `docker stacks service`.
2. Adds `servicesFormat` to config file.

Related docs has been updated.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-01 08:33:19 -08:00
Vincent Demeester
354bd4aadd Merge pull request #29692 from yongtang/29492-daemon-shm-size
Add daemon option `--default-shm-size`
2017-02-01 16:56:10 +01:00
Vincent Demeester
4c1b40b9d4 Merge pull request #28627 from yongtang/28624-docker-plugin-ls
Add `--filter enabled=true` for `docker plugin ls`
2017-02-01 16:52:00 +01:00
Vincent Demeester
27f90acd61 Merge pull request #22563 from mlaventure/cgroup-devices
Allow adding rules to cgroup devices.allow on container create/run
2017-02-01 16:29:34 +01:00
Phil Estes
feb8b1c581 Merge pull request #30506 from vdemeester/29732-follow-up-compose-indempotent
Make docker stack deploy a little bit more indempotent
2017-01-31 13:35:04 -08:00
Alexander Morozov
1d2f5de49a Merge pull request #30162 from yongtang/29972-service-read-only
Add `--read-only` for `service create` and `service update`
2017-01-31 13:20:00 -08:00
Alexander Morozov
048fc98c09 Merge pull request #30411 from thaJeztah/fix-build-from-local-github-directories
do not ignore local build-contexts starting with "github.com"
2017-01-31 12:45:11 -08:00
Alexander Morozov
3e6712a6ef Merge pull request #30521 from dnephin/cleanup-compose-loader
`cli/compose` cleanup - remove the old loading system
2017-01-30 13:55:23 -08:00
Yong Tang
499a0dd43e Add --read-only for service create and service update
This fix tries to address the issue raised in 29972 where
it was not possible to specify `--read-only` for `docker service create`
and `docker service update`, in order to have the container's root file
system to be read only.

This fix adds `--read-only` and update the `ReadonlyRootfs` in `HostConfig`
through `service create` and `service update`.

Related docs has been updated.

Integration test has been added.

This fix fixes 29972.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-30 12:47:26 -08:00
Alexander Morozov
a08da82a28 Merge pull request #30186 from thaJeztah/add-version-annotation-to-flags
Add version annotation to various flags added in 1.13
2017-01-30 12:33:36 -08:00
allencloud
e399c558e6 validate healthcheck params in daemon side
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-01-29 13:35:32 +08:00
allencloud
51b37a7983 remove cli/command/secrets/utils.go
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-01-29 13:32:49 +08:00
allencloud
9eacabbfb7 add endpoint mode a default value
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-01-28 20:46:34 +08:00
Daniel Nephin
daaeeafa7a Remove the old loading system from compose config loading
The original Compose config loading used the `compose` tag, which
was replaced by mapstructure. Some fields were left on the old tag. This
commit removes the old tag and uses types and mapstructure.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-27 17:03:41 -05:00
Alexander Morozov
3c32e1775a Merge pull request #29218 from yongtang/28884-secret-inspect-follow-up
Move secret name or ID prefix resolving from client to daemon
2017-01-27 13:31:04 -08:00
Yong Tang
d1982862ca Update opts.MemBytes to disable default, and move docker run/create/build to use opts.MemBytes
This fix made several updates:
1. Update opts.MemBytes so that default value will not show up.
   The reason is that in case a default value is decided by daemon,
   instead of client, we actually want to not show default value.
2. Move `docker run/create/build` to use opts.MemBytes for `--shm-size`
   This is to bring consistency between daemon and docker run
3. docs updates.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-27 12:17:06 -08:00
Yong Tang
db575ef626 Add daemon option --default-shm-size
This fix fixes issue raised in 29492 where it was not
possible to specify a default `--default-shm-size` in daemon
configuration for each `docker run``.

The flag `--default-shm-size` which is reloadable, has been
added to the daemon configuation.
Related docs has been updated.

This fix fixes 29492.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-27 12:17:06 -08:00
Yong Tang
fa358a8757 Move secret name or ID prefix resolving from client to daemon
This fix is a follow up for comment:
https://github.com/docker/docker/pull/28896#issuecomment-265392703

Currently secret name or ID prefix resolving is done at the client
side, which means different behavior of API and CMD.

This fix moves the resolving from client to daemon, with exactly the
same rule:
- Full ID
- Full Name
- Partial ID (prefix)

All existing tests should pass.

This fix is related to #288896, #28884 and may be related to #29125.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-27 10:40:05 -08:00
Harald Albers
aad095f573 Add [OPTIONS] to usage of plugin disable|push
Signed-off-by: Harald Albers <github@albersweb.de>
2017-01-27 16:17:02 +01:00
Vincent Demeester
8b1c6bfe3d
Make docker stack deploy a little bit more indempotent
Sort some slice fields before sending them to the swarm api so that it
won't trigger an update.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-27 16:09:02 +01:00
Yong Tang
a66e0dc349 Add --filter enabled=true for docker plugin ls
This fix adds `--filter enabled=true` to `docker plugin ls`,
as was specified in 28624.

The related API and docs has been updated.

An integration test has been added.

This fix fixes 28624.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-26 13:16:11 -08:00
Daniel Nephin
167b3f95b7 Set default values for uid and gid to prevent errors when starting a service.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-26 12:00:46 -05:00
Daniel Nephin
b4f23bbc69 Rebase Compose v3.1 schema on the latest v3 schema.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-26 11:33:15 -05:00
Daniel Nephin
f0a5531c46 Remove secrets as part of stack remove.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-26 11:33:15 -05:00
Daniel Nephin
b3427e43ed Test and fix external secrets in stack deploy.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-26 11:33:15 -05:00
Daniel Nephin
6ec84ef76d Add integration test for stack deploy with secrets.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-26 11:33:15 -05:00
Daniel Nephin
9419e7df2b Implement secret types for compose file.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-26 11:33:15 -05:00
Daniel Nephin
65374488f9 Add v3.1 schema and support validating multiple version.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-26 11:33:15 -05:00
Kenfe-Mickael Laventure
1756af6faf Allow adding rules to cgroup devices.allow on container create/run
This introduce a new `--device-cgroup-rule` flag that allow a user to
add one or more entry to the container cgroup device `devices.allow`

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-26 07:20:45 -08:00
Aaron Lehmann
e9c0de0de6 Merge pull request #30043 from dmcgowan/distribution-reference-update-1
Distribution reference update
2017-01-24 20:38:20 -08:00
Victor Vieux
42d25de1b7 Merge pull request #30291 from yongtang/30279-ps-format
Fix failure in `docker ps --format` when `.Label` has args
2017-01-24 17:55:52 -08:00
Victor Vieux
4726fd1203 Merge pull request #30325 from dnephin/add-internal-to-compose-network
Add network.internal to Compose schema
2017-01-24 17:16:08 -08:00
Sebastiaan van Stijn
37a1a84d91
do not ignore local build-contexts starting with "github.com"
Docker special-cases build-contexts starting with `github.com`, and
treats them as remote URLs.

Because of this special treatment, local build contexts in a directory
named "github.com" are ignored by `docker build`.

This patch changes the way the build-context is detected and first
checks if a local path with the given name exists before considering
it to be a remote URL.

Before this change;

    $ mkdir -p github.com/foo/bar && echo -e "FROM scratch\nLABEL iam=local" > github.com/foo/bar/Dockerfile

    $ docker build -t dont-ignore-me github.com/foo/bar
    Username for 'https://github.com':

After this change;

    $ mkdir -p github.com/foo/bar && echo -e "FROM scratch\nLABEL iam=local" > github.com/foo/bar/Dockerfile

    $ docker build -t dont-ignore-me github.com/foo/bar
    Sending build context to Docker daemon 2.048 kB
    Step 1/2 : FROM scratch
     --->
    Step 2/2 : LABEL iam local
     ---> Using cache
     ---> ae2c603fe970
    Successfully built ae2c603fe970

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-01-24 17:44:44 +01:00
Brian Goff
ee7682ebae Merge pull request #30378 from mlaventure/fix-negative-size
Ensure proper value is used when computing reclaimable space
2017-01-24 09:24:53 -05:00
Sebastiaan van Stijn
8820266c17 Merge pull request #29900 from yongtang/29226-network-format-created-at
Add `.CreatedAt` placeholder for `docker network ls --format`
2017-01-24 11:01:37 +01:00
Sebastiaan van Stijn
7fed0830f3 Merge pull request #30211 from thaJeztah/fix-content-trust-flags
fix flag descriptions for content-trust
2017-01-23 23:52:11 +01:00
Vincent Demeester
eac3e4b5dd Merge pull request #29883 from dnephin/update-to-latest-schema
Update compose schema v3
2017-01-23 23:18:31 +01:00
Kenfe-Mickael Laventure
dcc1b4baf6 Ensure proper value is used when computing reclaimable space
When Size was reverted to be equal to VirtualSize, the df command
formatter was not correctly updated to account for the change.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-23 13:57:20 -08:00
Aaron Lehmann
062f2a3eae Merge pull request #30139 from Microsoft/jjh/sequential
Windows: Use sequential file access
2017-01-23 12:46:06 -08:00
John Howard
c98e77c77c Windows: Use sequential file access
Signed-off-by: John Howard <jhoward@microsoft.com>
2017-01-23 10:25:36 -08:00
Yong Tang
2cd4ba1e56 Fix failure in docker ps --format when .Label has args
This fix tries to fix the issue in 30279 where  `docker ps --format`
fails if `.Label` has args. For example:
```
docker ps --format '{{.ID}}\t{{.Names}}\t{{.Label "some.label"}}'
```

The reason for the failure is that during the preprocessing phase
to detect the existance of `.Size`, the `listOptionsProcessor`
does not has a method of `Label(name string) string`.

This results in the failure of
```
template: :1:24: executing "" at <.Label>: Label is not a method but has arguments
```

This fix fixes the issue by adding needed method of `Label(name string) string`.

This fix fixes 30279.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-23 09:31:48 -08:00
Anusha Ragunathan
8bb8ac7f78 Merge pull request #29088 from yongtang/28708-plugin-list-format
Add `--format` flag for `docker plugin ls`
2017-01-23 08:49:28 -08:00
Sebastiaan van Stijn
bb3c0b2466
fix flag descriptions for content-trust
Commit ed13c3abfb added flags
for Docker Content Trust. Depending on the `verify` boolean,
the message is "Skip image verification", or "Skip image signing".
"Signing" is intended for `docker push` / `docker plugin push`.

During the migration to Cobra, this boolean got flipped for
`docker push` (9640e3a451),
causing `docker push` to show the incorrect flag description.

This patch changes the flags to use the correct description
for `docker push`, and `docker plugin push`.

To prevent this confusion in future, the boolean argument
is removed, and a `AddTrustSigningFlags()` function is added.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-01-23 14:52:36 +01:00
Vincent Demeester
baecb6f499 Merge pull request #30272 from AkihiroSuda/fix-cli-json
Fix broken JSON support in cli/command/formatter
2017-01-23 11:03:18 +01:00
Yong Tang
1c0d37fa7f Add --format flag for docker plugin ls
This fix tries to address the enhancement discussed in 28735 to add
`--format` for the output of `docker plugin ls`.

This fix
1. Add `--format` and `--quiet` flags to `docker plugin ls`
2. Convert the current implementation to use `formatter`, consistent with
   other docker list commands.
3. Add `pluginsFormat` for config.json.

Related docs has been updated.

Several unit tests have been added to cover the changes.

This fix is related to 28708 and 28735.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-20 15:59:44 -08:00
Daniel Nephin
408fd20be2 Add missing network.internal.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-20 12:53:19 -05:00
Daniel Nephin
de1ffebf19 Update Compose schema to match docker-compose.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-20 12:36:57 -05:00
Derek McGowan
0421f5173d
Remove use of forked reference package for cli
Use resolving to repo info as the split point between the
legitimate reference package and forked reference package.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-01-19 16:04:50 -08:00
Akihiro Suda
26013fcdd6 Fix broken JSON support in cli/command/formatter
How to test (it should not print `{}`, and just returns JSON with the actual data):

   $ docker images --format '{{json .}}'
   $ docker container stats --format '{{json .}}'

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-19 09:51:13 +00:00
allencloud
8e04e9902a return error when listNode fails
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-01-19 14:02:06 +08:00
Akihiro Suda
7d0041f9e5 Merge pull request #30218 from kevinetc123/patch-typo
fix a typo error
2017-01-19 14:34:19 +09:00
kaiwentan
b8155bd5be correct all the formate to formatter
Signed-off-by: kaiwentan <kaiwentan@harmonycloud.cn>
2017-01-19 11:26:49 +08:00
Sebastiaan van Stijn
5eda0c5947 Merge pull request #28925 from daehyeok/ineffassign
Refactoring ineffectual assignments
2017-01-18 15:01:57 +01:00
allencloud
3f1feaf4d6 purify error message in cli for create and run command
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-01-17 17:21:17 +08:00
Sebastiaan van Stijn
bbbddeebba
Add version annotation to various flags added in 1.13
Pull request https://github.com/docker/docker/pull/27745 added support for the
client to talk to older versions of the daemon. Various flags were added to
docker 1.13 that are not compatible with older daemons.

This PR adds annotations to those flags, so that they are automatically hidden
if the daemon is older than docker 1.13 (API 1.25).

Not all new flags affect the API (some are client-side only). The following
PR's added new flags to docker 1.13 that affect the API;

- https://github.com/docker/docker/pull/23430 added `--cpu-rt-period`and `--cpu-rt-runtime`
- https://github.com/docker/docker/pull/27800 / https://github.com/docker/docker/pull/25317 added `--group` / `--group-add` / `--group-rm`
- https://github.com/docker/docker/pull/27702 added `--network` to `docker build`
- https://github.com/docker/docker/pull/25962 added `--attachable` to `docker network create`
- https://github.com/docker/docker/pull/27998 added `--compose-file` to `docker stack deploy`
- https://github.com/docker/docker/pull/22566 added `--stop-timeout` to `docker run` and `docker create`
- https://github.com/docker/docker/pull/26061 added `--init` to `docker run` and `docker create`
- https://github.com/docker/docker/pull/26941 added `--init-path` to `docker run` and `docker create`
- https://github.com/docker/docker/pull/27958 added `--cpus` on `docker run` / `docker create`
- https://github.com/docker/docker/pull/27567 added `--dns`, `--dns-opt`, and `--dns-search` to `docker service create`
- https://github.com/docker/docker/pull/27596 added `--force` to `docker service update`
- https://github.com/docker/docker/pull/27857 added `--hostname` to `docker service create`
- https://github.com/docker/docker/pull/28031 added `--hosts`, `--host-add` / `--host-rm` to `docker service create` and `docker service update`
- https://github.com/docker/docker/pull/28076 added `--tty` on `docker service create` / `docker service update`
- https://github.com/docker/docker/pull/26421 added `--update-max-failure-ratio`, `--update-monitor` and `--rollback` on `docker service update`
- https://github.com/docker/docker/pull/27369 added `--health-cmd`, `--health-interval`, `--health-retries`, `--health-timeout` and `--no-healthcheck` options to `docker service create` and `docker service update`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-01-16 18:21:20 +01:00
Sebastiaan van Stijn
0ea7b143b0
Don't use AutoRemove on older daemons
Docker 1.13 moves the `--rm` flag to the daemon,
through an AutoRemove option in HostConfig.

When using API 1.24 and under, AutoRemove should not be
used, even if the daemon is version 1.13 or above and
"supports" this feature.

This patch fixes a situation where an 1.13 client,
talking to an 1.13 daemon, but using the 1.24 API
version, still set the AutoRemove property.

As a result, both the client _and_ the daemon
were attempting to remove the container, resulting
in an error:

    ERRO[0000] error removing container: Error response from daemon:
    removal of container ce0976ad22495c7cbe9487752ea32721a282164862db036b2f3377bd07461c3a
    is already in progress

In addition, the validation of conflicting options
is moved from `docker run` to `opts.parse()`, so
that conflicting options are also detected when
running `docker create` and `docker start` separately.

To resolve the issue, the `AutoRemove` option is now
always set to `false` both by the client and the
daemon, if API version 1.24 or under is used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-01-15 01:59:57 +01:00
Brian Goff
7d24cc7710 Merge pull request #29856 from Microsoft/jjh/warntoout
Windows to Linux build warning to stdout
2017-01-14 16:37:31 -05:00
Tony Abboud
135f8f9674 Add error checking for hostPort range
This fix catches the case where there is a single container port
and a dynamic host port and will fail out gracefully
Example docker-compose.yml snippet:
    port:
        ports:
            - "8091-8093:8091"
            - "80:8080"

Signed-off-by: Tony Abboud <tdabboud@hotmail.com>
2017-01-13 18:05:51 -05:00
Josh Hawn
77b8465d7e Add SecretUpdate method to client
closes #28678

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)

Update cli/command/service/update_test.go

Fixes test build error:

  secretAPIClientMock does not implement "github.com/docker/docker/client".SecretAPIClient (missing SecretUpdate method)

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2017-01-13 09:51:05 -08:00
Daehyeok Mun
6306019d0b Refactoring ineffectual assignments
This patch fixed below 4 types of code line
1. Remove unnecessary variable assignment
2. Use variables declaration instead of explicit initial zero value
3. Change variable name to underbar when variable not used
4. Add erro check and return for ignored error

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2017-01-13 00:27:01 -07:00
Kenfe-Mickael Laventure
be20dc15af Fix ImageSummary.Size value
The prune PR changed the meaning of the file to mean "space on disk
only unique to this image", this PR revert this change.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-01-12 07:49:22 -08:00
Daniel Nephin
46422df490 Improve the error message for extends in stack deploy.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-11 11:57:24 -05:00
Yong Tang
0f30c64444 Allow swarm init with --availability=drain
This fix adds a new flag `--availability` to `swarm join`.

Related documentation has been updated.

An integration test has been added.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-10 16:31:51 -08:00
Yong Tang
a8e7e37aa8 Allow swarm join with --availability=drain
This fix tries to address the issue raised in 24596 where it was not
possible to join as manager only (`--availability=drain`).

This fix adds a new flag `--availability` to `swarm join`.

Related documentation has been updated.

An integration test has been added.

NOTE: Additional pull request for swarmkit and engine-api will
be created separately.

This fix fixes 24596.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-10 16:31:51 -08:00
Vincent Demeester
3191f5809b
Few stack deploy network fixes
- Make sure we use the correct network name for external ones.
- Make the default network overridable and only creates networks that
  are used by services — so that default network is only created if a
  service doesn't declare a network.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-10 10:29:09 +01:00
Sebastiaan van Stijn
8563492eef Merge pull request #30005 from dnephin/fix-stack-deploy-resources
Fix parsing resources from compose file for stack deploy.
2017-01-09 22:50:01 +01:00
Vincent Demeester
d6c8391bf6 Merge pull request #29918 from dongluochen/service_inspect_pretty
add port PublishMode to service inspect --pretty output
2017-01-09 22:43:41 +01:00
Sebastiaan van Stijn
cd82a31edb Merge pull request #29802 from thaJeztah/fix-secret-rm-consistency
Update order of '--secret-rm' and '--secret-add'
2017-01-09 21:34:05 +01:00
Sebastiaan van Stijn
38f766ae0e Merge pull request #29143 from vdemeester/node-cli-unit-tests
Add some unit tests to the node and swarm cli code
2017-01-09 20:52:23 +01:00
Daniel Nephin
e3f083530f Fix parsing resources from compose file for stack deploy.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-09 14:22:02 -05:00
Dong Chen
5470312d23 add port PublishMode to service inspect --pretty output
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
2017-01-09 10:30:28 -08:00
Tibor Vass
3e298f46a2 Merge pull request #29955 from vieux/improve_secret_Create
remove -f on secret create and unify usage with other commands
2017-01-09 10:22:39 -08:00
Vincent Demeester
f151c297eb
Add some unit tests to the node and swarm cli code
Start work on adding unit tests to our cli code in order to have to
write less costly integration test.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-09 18:30:15 +01:00
Sebastiaan van Stijn
f1fdbeca2a Merge pull request #29226 from yongtang/28535-prune-until-follow-up
Add `--filter until=<timestamp>` for `docker container/image prune`
2017-01-09 17:58:01 +01:00
Brian Goff
d0053a34bc Merge pull request #29688 from tronicum/since-flag
explain since format and give examples
2017-01-09 09:27:30 -05:00