Commit graph

939 commits

Author SHA1 Message Date
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
ttronicum
519c35889e explain since format and give examples
Signed-off-by: tronicum <tronicum@user.github.com>
2017-01-08 05:27:54 +01:00
Stephen J Day
7a85579917
*: use opencontainers/go-digest package
The `digest` data type, used throughout docker for image verification
and identity, has been broken out into `opencontainers/go-digest`. This
PR updates the dependencies and moves uses over to the new type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-06 18:48:41 -08:00
Victor Vieux
db6652ca71 remove -f on secret create and unify usage with other commands
Signed-off-by: Victor Vieux <vieux@docker.com>
2017-01-06 14:07:48 -08:00
Yong Tang
0ad02c6108 Add .CreatedAt placeholder for docker network ls --format
This fix tries to add a placeholder `.CreatedAt` for Go
format template in `docker network ls --format`.

While working on 29226, I noticed that it is not possible to
display network's creation time in `docker network ls`, with or
without `--format`.

We are able to find the timestamp through `docker network inspect` though.

However, as we allows networks to be pruned based on the timestamp
(see 29226), showing the timestamp in `docker network ls --format`
would be much useful now.

This fix adds the `.CreatedAt` placeholder for `docker network ls --format`.
The default output was not changed for `docker network ls --format`.

A test case for unit tests has been added.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-04 15:18:44 -08:00
Yong Tang
58738cdee3 Add --filter until=<timestamp> for docker container/image prune
This fix is a follow up for comment
https://github.com/docker/docker/pull/28535#issuecomment-263215225

This fix provides `--filter until=<timestamp>` for `docker container/image prune`.

This fix adds `--filter until=<timestamp>` to `docker container/image prune`
so that it is possible to specify a timestamp and prune those containers/images
that are earlier than the timestamp.

Related docs has been updated

Several integration tests have been added to cover changes.

This fix fixes #28497.

This fix is related to #28535.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-01-04 14:16:42 -08:00
yuexiao-wang
4f9b076e8e keep network option consistent between network connect and run
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2017-01-04 19:54:03 +08:00
John Howard
d45c652e83 Windows to Linux build warning to stdout
Signed-off-by: John Howard <jhoward@microsoft.com>

When building a Dockerfile from a Windows client on a Linux daemon, a
"security warning" is printed
on stderr. Having this warning printed on stderr makes it difficult to
distinguish a failed build from one that's succeeding, and the only way to
suppress the warning is through the -q option, which also suppresses every
output. This change prints the warning on stdout, instead of stderr, to
resolve this situation.
2017-01-03 14:07:50 -08:00
Daniel Nephin
abe32de6b4 Trim quotes from TLS flags.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-01-03 15:58:41 -05:00
Sebastiaan van Stijn
e4223e3361 Merge pull request #26830 from dnephin/man-desc-in-files
Move the command description to a markdown file for man pages
2017-01-03 17:47:49 +01:00
Vincent Demeester
18265591c2 Merge pull request #25234 from yongtang/25228-service-ps-multiple-ID
Support multiple service IDs on "docker service ps"
2017-01-03 12:40:24 +01:00
Vincent Demeester
187592583c Merge pull request #29806 from albers/fix-plugin-inspect-usage
Fix usage message of `plugin inspect`
2017-01-02 19:30:24 +01:00
Vincent Demeester
84cb2d100b
Remove deadcode from service/opts.go, SecretOpt
`SecretOpt` is in the `opts` package, this one is never used, so it's
dead code, removing it 👼.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-01-02 11:19:33 +01:00
Harald Albers
1b58d0bc51 Fix usage message of plugin inspect
Signed-off-by: Harald Albers <github@albersweb.de>
2016-12-31 09:55:04 -08:00
Sebastiaan van Stijn
e91953407c
Update order of '--secret-rm' and '--secret-add'
When using both `--secret-rm` and `--secret-add` on `docker service update`,
`--secret-rm` was always performed last. This made it impossible to update
a secret that was already in use on a service (for example, to change
it's permissions, or mount-location inside the container).

This patch changes the order in which `rm` and `add` are performed,
allowing updating a secret in a single `docker service update`.

Before this change, the `rm` was always performed "last", so the secret
was always removed:

    $ echo "foo" | docker secret create foo -f -
    foo

    $ docker service create --name myservice --secret foo nginx:alpine
    62xjcr9sr0c2hvepdzqrn3ssn

    $ docker service update --secret-rm foo --secret-add source=foo,target=foo2 myservice
    myservice

    $ docker service inspect --format '{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}' myservice | jq .
    null

After this change, the `rm` is performed _first_, allowing users to
update a secret without updating the service _twice_;

    $ echo "foo" | docker secret create foo -f -
    1bllmvw3a1yaq3eixqw3f7bjl

    $ docker service create --name myservice --secret foo nginx:alpine
    lr6s3uoggli1x0hab78glpcxo

    $ docker service update --secret-rm foo --secret-add source=foo,target=foo2 myservice
    myservice

    $ docker service inspect --format '{{ json .Spec.TaskTemplate.ContainerSpec.Secrets }}' myservice | jq .

    [
      {
        "File": {
          "Name": "foo2",
          "UID": "0",
          "GID": "0",
          "Mode": 292
        },
        "SecretID": "tn9qiblgnuuut11eufquw5dev",
        "SecretName": "foo"
      }
    ]

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-31 14:55:29 +01:00
Tõnis Tiigi
edaa3c6f07 Merge pull request #29609 from dnephin/add-compose-file-package
Replace the vendored aanand/compose-file with a local copy
2016-12-29 15:12:59 -08:00
Sebastiaan van Stijn
1dd9410776 Merge pull request #29683 from vdemeester/runconfig-clean
Clean some stuff from runconfig that are cli only…
2016-12-29 17:42:08 +01:00
Vincent Demeester
4d5cba127b Merge pull request #29687 from thaJeztah/cleanup-cli-command-container
Minor cleanups in cli/command/container
2016-12-29 09:31:46 +01:00
Xianglin Gao
e03b55a2f5 exit collect when we get EOF
Signed-off-by: Xianglin Gao <xlgao@zju.edu.cn>
2016-12-29 13:38:30 +08:00
Daniel Nephin
78101b26af Read long description from a file.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-12-28 16:08:23 -05:00
Alexander Morozov
4f657ff55c Merge pull request #29313 from vdemeester/move-cli-config
Move package cliconfig to cli/config
2016-12-28 09:05:51 -08:00
Brian Goff
a412c1b7a0 Merge pull request #29668 from dmcgowan/plugins-dct
Support Docker Content Trust for plugins
2016-12-28 10:43:32 -05:00
Doug Davis
9fab262690 Merge pull request #29752 from allencloud/fix-nits-in-comments
fix nits in comments
2016-12-28 08:33:48 -05:00
Daniel Nephin
f5af9b9738 Replace vendor of aanand/compose-file with a local copy.
Add go-bindata for including the schema.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-12-27 16:17:24 -05:00
Derek McGowan
14e8bba4f5
Support for docker content trust for plugins
Add integration test for docker content trust

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-12-27 12:51:00 -08:00
Brian Goff
bf6eb85539 Merge pull request #29666 from tonistiigi/client-deps
Clean up client binary dependencies
2016-12-27 15:01:24 -05:00
Brian Goff
efbb23f3e6 Merge pull request #29716 from yongtang/28885-docker-stack-ps-all
Remove `docker stack ps -a` to match removal of `docker service/node ps -a`
2016-12-27 13:56:01 -05:00
allencloud
6fb05778ba fix nits in comments
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-12-27 23:30:50 +08:00
Tonis Tiigi
feaf5902f6 Move builder cli helper functions to own pkg
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-12-26 18:53:22 -08:00
Tonis Tiigi
13222160e8 Define PushResult in api types
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-12-26 18:53:22 -08:00
Yong Tang
9155e14e77 Remove docker stack ps -a to match removal of docker service/node ps -a
In #28507 and #28885, `docker service/node ps -a` has been removed so that
information about slots are show up even without `-a` flag.

The output of `docker stack ps` reused the same output as `docker service/node ps`.
However, the `-a` was still there. It might make sense to remove `docker stack ps -a`
as well to bring consistency with `docker service/node ps`.

This fix is related to #28507, #28885, and #25983.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-26 13:47:43 -08:00
allencloud
0b243acbfc split function out of command description scope
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-12-26 13:50:00 +08:00
Sebastiaan van Stijn
d5179cb4d4
Minor cleanups in cli/command/container
This change does some minor cleanups in the
cli/command/container package;

- sort imports
- replace `fmt.Fprintf()` with `fmt.Fprintln()` if no formatting is used
- replace `fmt.Errorf()` with `errors.New()` if no formatting is used
- remove some redundant `else`'s

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-26 01:33:25 +01:00
Vincent Demeester
ce964a607a
Move package cliconfig to cli/config
I felt it made more sence 👼

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-25 20:31:52 +01:00
Vincent Demeester
c424be21b7
Clean some stuff from runconfig that are cli only…
… or could be in `opts` package. Having `runconfig/opts` and `opts`
doesn't really make sense and make it difficult to know where to put
some code.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-24 13:16:00 +01:00
Tonis Tiigi
3d86b0c79b Implement content addressability for plugins
Move plugins to shared distribution stack with images.

Create immutable plugin config that matches schema2 requirements.

Ensure data being pushed is same as pulled/created.

Store distribution artifacts in a blobstore.

Run init layer setup for every plugin start.

Fix breakouts from unsafe file accesses.

Add support for `docker plugin install --alias`

Uses normalized references for default names to avoid collisions when using default hosts/tags.

Some refactoring of the plugin manager to support the change, like removing the singleton manager and adding manager config struct.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2016-12-23 13:29:58 -08:00
Anusha Ragunathan
d1dfc1a5ef Merge pull request #29599 from anusha-ragunathan/refcount
Enforce zero plugin refcount during disable, not remove.
2016-12-22 15:38:54 -08:00
Anusha Ragunathan
8cb2229cd1 Enforce zero plugin refcount during disable.
When plugins have a positive refcount, they were not allowed to be
removed. However, plugins could still be disabled when volumes
referenced it and containers using them were running.

This change fixes that by enforcing plugin refcount during disable.
A "force" disable option is also added to ignore reference refcounting.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-12-22 13:26:53 -08:00
Yong Tang
70942352d5 Support multiple service IDs on "docker service ps"
This fix tries to address issue raised in 25228 to support
multiple service IDs on `docker service ps`.

Multiple IDs are allowed with `docker service ps ...`, and
related documentation has been updated.

A test has been added to cover the changes.

This fix fixes 25228.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-22 11:33:47 -08:00
Sebastiaan van Stijn
b9ee31ae02 Merge pull request #29314 from vdemeester/no-more-utils
Remove the utils package
2016-12-22 15:21:05 +01:00
Vincent Demeester
0ca3e84227 Merge pull request #29603 from mstanleyjones/docker_diff_improvements
Clarify what docker diff shows
2016-12-22 15:15:01 +01:00
Vincent Demeester
8f9a48ab5a Merge pull request #29565 from yuexiao-wang/fix-typo-tls
Change tls to TLS
2016-12-22 12:10:09 +01:00
Brian Goff
e91604c0d2 Merge pull request #29212 from yongtang/29185-docker-inspect
Fix `docker plugin inspect <unkown object>` issue on Windows
2016-12-21 15:47:17 -05:00
Brian Goff
267d6935c5 Merge pull request #28714 from thaJeztah/move-logdriver-check-to-daemon
move check for supported drivers to daemon
2016-12-21 13:47:30 -05:00
Brian Goff
d65d5db2a0 Merge pull request #29491 from yongtang/12162016-stats-error
Improve error output for `docker stats ...`
2016-12-21 13:19:20 -05:00
Brian Goff
b2e348f2a6 Merge pull request #29527 from allencloud/change-minor-mistake
change minor mistake of spelling
2016-12-21 13:15:00 -05:00
Yong Tang
0b3c10ac4d Fix docker plugin inspect <unkown object> issue on Windows
This fix is a follow up for comment:
https://github.com/docker/docker/pull/29186/files#r91277345

While #29186 addresses the issue of `docker inspect <unknown object>`
on Windows, it actually makes `docker plugin inspect <unknown object>`
out `object not found` on Windows as well. This is actually misleading
as plugin is not supported on Windows.

This fix reverted the change in #29186 while at the same time,
checks `not supported` in `docker inspect <unknown object>` so that
- `docker plugin inspect <unknown object>` returns `not supported` on Windows
- `docker inspect <unknown object>` returns `not found` on Windows

This fix is related to #29186 and #29185.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-20 21:05:10 -08:00
Misty Stanley-Jones
4497801c8a Clarify what docker diff shows
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
2016-12-20 17:03:11 -08:00
Tibor Vass
0d5a715931 Merge pull request #29470 from cyli/ask-for-unlock-key-only-if-locked
Check if a swarm is locked before asking a user to enter their unlock key
2016-12-20 13:21:47 -08:00
yuexiao-wang
113cae5ba2 Change tls to TLS
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2016-12-20 22:08:07 +08:00
allencloud
7c3657065c change minor mistake of spelling
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-12-20 21:05:19 +08:00
Yong Tang
acc93db32b Fix misleading default for --replicas
This fix tries to address the issue raised in 29291 where
the output of `--replicas` in `service create/update`:
```
      --replicas uint                    Number of tasks (default none)
```
is misleading. User might incorrectly assume the number of replicas
would be `0` (`none`) by default, while the actual default is `1`.

The issue comes from the fact that some of the default values are
from daemon and it is not possible for client to find out the default
value.

In this case, it might be better to just simply not displaying `(default none)`.

This fix returns "" for `Uint64Opt` so that `(default none)` is hidden.

In addition to `--replicas`, this fix also changes
`--restart-delay`, `--restart-max-attempts`, `--stop-grace-period`,
`--health-interval`, `--health-timeout`, and `--restart-window`
in a similiar fashion.

New Output:
```
      --health-interval duration         Time between running the check (ns|us|ms|s|m|h)
      --health-timeout duration          Maximum time to allow one check to run (ns|us|ms|s|m|h)
...
      --replicas uint                    Number of tasks
...
      --restart-delay duration           Delay between restart attempts (ns|us|ms|s|m|h)
      --restart-max-attempts uint        Maximum number of restarts before giving up
      --restart-window duration          Window used to evaluate the restart policy (ns|us|ms|s|m|h)
...
      --stop-grace-period duration       Time to wait before force killing a container (ns|us|ms|s|m|h)
```

The docs has been updated. Note the docs for help output of `service create/update`
is out of sync with the current master. This fix replace with the update-to-date
help output.

This fix fixes 29291.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-19 19:35:05 -08:00
Tibor Vass
77dde3efa7 Merge pull request #29246 from thaJeztah/improve-swarm-check-in-inspect
Ignore certificate expiry error for top-level inspect
2016-12-19 15:37:53 -08:00
Tõnis Tiigi
aecb79ff98 Merge pull request #29339 from dmcgowan/plugins-abstract-download-manager
Abstract layerstore from pull/push distribution code
2016-12-19 13:32:28 -08:00
Derek McGowan
3c7676a057
Abstract distribution interfaces from image specific types
Move configurations into a single file.
Abstract download manager in pull config.
Add supports for schema2 only and schema2 type checking.
Add interface for providing push layers.
Abstract image store to generically handle configurations.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2016-12-19 10:55:00 -08:00
Sebastiaan van Stijn
05dc9846e1
remove client-side for supported logging drivers
The `docker logs` command performed a
client-side check if the container's
logging driver was supported.

Now that we allow the client to connect
to both "older" and "newer" daemon versions,
this check is best done daemon-side.

This patch remove the check on the client
side, and leaves validation to the daemon,
which should be the source of truth.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-19 14:30:01 +01:00
Sebastiaan van Stijn
120241937e
Improve validation for volume specs
The current validation only checked for the
number of elements in the volume-spec, however,
did not validate if the elements were empty.

Because of this, an empty volume-spec (""),
or volume spec only containing separators ("::")
would not be invalidated.

This adds a simple check for empty elements in
the volume-spec, and returns an error if
the spec is invalid.

A unit-test is also added to verify the behavior.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-19 01:50:08 +01:00
Sebastiaan van Stijn
34889e579f
fix conversion of anonymous volumes in compose-file
the `convertVolumeToMount()` function did not take
anonymous volumes into account when converting
volume specifications to bind-mounts.

this resulted in the conversion to try to
look up an empty "source" volume, which
lead to an error;

    undefined volume:

this patch distinguishes "anonymous"
volumes from bind-mounts and named-volumes,
and skips further processing if no source
is defined (i.e. the volume is "anonymous").

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-18 16:50:32 +01:00
Sebastiaan van Stijn
4436a5946d Merge pull request #28629 from yongtang/28581-secret-create-input
Add `--file` flag for `docker secret create` command
2016-12-18 03:04:10 +01:00
Yong Tang
32de162fc9 Improve error output for docker stats ...
While looking into `docker stats <c1> <c2> ...` I noticed that
the error output is quite long, especially if there are multiple errors:
```sh
ubuntu@ubuntu:~/docker$ docker stats nofound
: Error response from daemon: No such container: nofound
ubuntu@ubuntu:~/docker$ docker stats nofound foo bar
: Error response from daemon: No such container: nofound, : Error response from daemon: No such container: foo, : Error response from daemon: No such container: bar
```

There are several issues,
1. There is an extra `: ` at the beginning. That is because if container is not found,
the name will not be available from the daemon.
2. Multiple errors are concatenated with `, ` which will be quite long.

This fix:
1. Only prient out the error from daemon.
2. Multiple errors are printed out line by line.

Below is the new output:
```sh
ubuntu@ubuntu:~/docker$ docker stats nofound
Error response from daemon: No such container: nofound
ubuntu@ubuntu:~/docker$ docker stats nofound foo bar
Error response from daemon: No such container: nofound
Error response from daemon: No such container: foo
Error response from daemon: No such container: bar
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-17 16:51:11 -08:00
Sebastiaan van Stijn
2121041944 Merge pull request #29423 from unclejack/api_cli_integ_return
return directly without ifs in remaining packages
2016-12-17 21:30:47 +01:00
Ying Li
a6a0880a22 Before asking a user for the unlock key when they run docker swarm unlock, actually
check to see if the node is part of a swarm, and if so, if it is unlocked first.
If neither of these are true, abort the command.

Signed-off-by: Ying Li <ying.li@docker.com>
2016-12-16 17:16:55 -08:00
Vincent Demeester
914a72541f Merge pull request #29003 from dnephin/pkg-compose-transform
Move composefile -> engine api type conversion to `cli/compose/convert`
2016-12-16 23:34:41 +01:00
Daniel Nephin
643fd775ed Move pkg to cli/compose/convert
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-12-16 12:27:31 -05:00
Daniel Nephin
655e48e653 Move ConvertService to composetransform package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-12-16 12:20:07 -05:00
Daniel Nephin
7685e80fc9 Move ConvertVolumes to composetransform package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-12-16 11:51:13 -05:00
Daniel Nephin
6b778c9633 Move ConvertNetworks to composetransform package.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-12-16 11:51:13 -05:00
Sebastiaan van Stijn
f89eee5d9d
swarm leave is not only for workers
the "docker swarm leave" command description
mentioned that the command can only be used
for workers, however, the command can also
be used for managers (using the `-f` / `--force`
option).

this patch removes the "(workers only)" part
of the command description.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-16 15:10:20 +01:00
unclejack
2c187a24e0 return directly without ifs in remaining packages
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2016-12-14 23:28:27 +02:00
Aaron Lehmann
d4d6f8c0d0 cli: Pin image to digest using content trust
Implement notary-based digest lookup in the client when
DOCKER_CONTENT_TRUST=1.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-12-14 10:49:33 -08:00
Aaron Lehmann
4b8c79f25e cli: Split out GetNotaryRepository and associated functions
Split these into cli/trust so that other commands can make use of them.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-12-14 10:49:32 -08:00
Sebastiaan van Stijn
2fe62f2395 Merge pull request #28943 from vdemeester/publish-long-short-syntax
Remove --port and update --publish for services to support syntaxes
2016-12-14 17:55:48 +01:00
Vincent Demeester
5665c73642 Merge pull request #29288 from Microsoft/jjh/promptusestdin
Windows: Prompt fix use regular stdin
2016-12-13 21:18:54 +01:00
Sebastiaan van Stijn
66cf4cc7f7
Ignore certificate expiry error for top-level inspect
The top-level `docker inspect` command could return
an error if the nodes Swarm certificates were expired.

In situations where the user did not explicitly
ask for an object-type (`--type=foo`), we should
ignore these errors, and consider them equal to
"node is not a swarm manager".

This change makes `docker inspect` ignore these
errors if no type was specified.

As a further optimization, the "swarm status"
result is now stored in a variable, so that
other swarm-specific API calls can be skipped.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-13 17:22:43 +01:00
Yong Tang
c6f0b7f448 Add --file flag for docker secret create command
This fix tries to address the issue raised in 28581 and 28927
where it is not possible to create a secret from a file (only
through STDIN).

This fix add a flag `--file` to `docker secret create` so that
it is possible to create a secret from a file with:
```
docker secret create --file secret.in secret.name
```

or
```
echo TEST | docker secret create --file - secret.name
```

Related docs has been updated.

An integration test has been added to cover the changes.

This fix fixes 28581.
This fix is related to 28927.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-13 07:35:45 -08:00
Yong Tang
5aa5a1cb00 Show usage when docker swarm update has no flags
This fix tries to address the issue raised in 24352. Previously,
when `docker swarm update` has no flags, the output is
```
Swarm updated.
```
even though nothing was updated. This could be misleading for
users.

This fix tries to address the issue by adding a `PreRunE` function
in the command so that in case no flag is provided (`cmd.Flags().NFlag() == 0`),
the usage will be outputed instead.

An integration has been added to cover the changes.

This fix fixes 24352.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-13 05:05:04 -08:00
Vincent Demeester
3d52c86d4c Merge pull request #29267 from yuexiao-wang/fix-bulid-para
Update the option for docker build
2016-12-13 08:55:20 +01:00
yuexiao-wang
cd317282c9 Update the option 'network' for docker build
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
2016-12-13 18:18:53 +08:00
Sebastiaan van Stijn
91dd29acdc Merge pull request #29196 from aluzzardi/service-ps-output
service ps: Revert output to 1.12 behavior.
2016-12-12 17:20:45 +01:00
Vincent Demeester
04f7a03359
Move templates to pkg/templates
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-12 09:34:03 +01:00
Vincent Demeester
ce37550347
Move debug functions to cli/debug package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-12 09:33:58 +01:00
Vincent Demeester
9d4aa3621f Make --publish-rm precedes --publish-add, so that add wins
`--publish-add 8081:81 --publish-add 8082:82 --publish-rm 80
--publish-rm 81/tcp --publish-rm 82/tcp` would thus result in 81 and
82 to be published.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-11 23:14:54 +01:00
Vincent Demeester
75bf18c9f0 Remove --port and update --publish for services to support syntaxes
Add support for simple and complex syntax to `--publish` through the
use of `PortOpt`.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-11 23:14:54 +01:00