Commit graph

711 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
John Howard
30b8f08443 Windows: Prompt fix
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-12-09 14:27:53 -08:00
Sebastiaan van Stijn
032b5b21b6 Merge pull request #25860 from yongtang/1396-service-update-publish-rm
Return error for incorrect argument of `service update --publish-rm`
2016-12-08 20:09:56 +01:00
Sebastiaan van Stijn
cefda34773 Merge pull request #29020 from wefine/commands_order
Give a order to AddCommands, for better read and maintenance.
2016-12-08 15:13:22 +01:00
Sebastiaan van Stijn
e94a40cdda Merge pull request #29041 from aaronlehmann/hide-updatestatus
api: Hide UpdateStatus when it is not present
2016-12-08 13:55:13 +01:00
wefine
6174adc4b3 Give a order to AddCommands, for easy read and maintenance.
Signed-off-by: wefine <wang.xiaoren@zte.com.cn>
2016-12-08 16:43:14 +08:00
Tõnis Tiigi
dca76ed50a Merge pull request #29104 from duglin/Issue29084
Fix processing of unset build-args during build
2016-12-07 17:18:55 -08:00
Doug Davis
cdb8ea90b0 Fix processing of unset build-args during build
This reverts 26103.  26103 was trying to make it so that if someone did:
  docker build --build-arg FOO .
and FOO wasn't set as an env var then it would pick-up FOO from the
Dockerfile's ARG cmd.  However, it went too far and removed the ability
to specify a build arg w/o any value. Meaning it required the --build-arg
param to always be in the form "name=value", and not just "name".

This PR does the right fix - it allows just "name" and it'll grab the value
from the env vars if set. If "name" isn't set in the env then it still needs
to send "name" to the server so that a warning can be printed about an
unused --build-arg. And this is why buildArgs in the options is now a
*string instead of just a string - 'nil' == mentioned but no value.

Closes #29084

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-12-07 07:41:55 -08:00
Andrea Luzzardi
bbd2018ee1 service ps: Revert output to 1.12 behavior.
- Display the ID column
- Do not append the task ID in the name column
- (NEW): Truncate task IDs, unless --no-trunc is specified

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2016-12-06 18:52:47 -08:00
Aaron Lehmann
d91ed88365 registry: Remove reference.go
This removes some very old vestigial code that really should have been
removed during the content addressability transition. It implements
something called "reference" but it behaves differently from the actual
reference package. This was only used by client-side content trust code,
and is relatively easy to extricate.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2016-12-06 15:53:21 -08:00
Vincent Demeester
7f9ba93914 Merge pull request #29073 from adshmh/28756-print-checkpoint-name-in-checkpoint-create-command
Print checkpoint id when creating a checkpoint
2016-12-06 11:06:29 +01:00
Vincent Demeester
57d77cc205 Merge pull request #28896 from yongtang/28884-secret-name-mask-ID
Fix issue where secret ID is masked by name
2016-12-06 11:05:30 +01:00
Vincent Demeester
745795ef2e Merge pull request #28535 from yongtang/28497-prune-until
Convert DanglingOnly to Filters for `docker image prune`
2016-12-06 11:03:45 +01:00
Vincent Demeester
806cc1e0f8
Handle logging in compose to swarm
Logging configuration was completely ignore when deploy a compose file
to swarm. This fixes it.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-12-05 15:18:36 +01:00
Anusha Ragunathan
24ffa2fa77 Merge pull request #28967 from yongtang/28946-support-plugin-docker-inspect
Support plugin type in `docker inspect`
2016-12-04 18:30:38 -08:00
Yong Tang
3638ca4d14 Fix issue where secret ID is masked by name
This fix tries to address the issue in 28884 where
it is possible to mask the secret ID by name.

The reason was that searching a secret is based on name.
However, searching a secret should be done based on:
- Full ID
- Full Name
- Partial ID (prefix)

This fix addresses the issue by changing related implementation
in `getCliRequestedSecretIDs()`

An integration test has been added to cover the changes.

This fix fixes 28884

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-02 20:24:29 -08:00
Yong Tang
a6be56b54e Convert DanglingOnly to Filters for docker image prune
This fix convert DanglingOnly in ImagesPruneConfig to Filters,
so that it is possible to maintain API compatibility in the future.

Several integration tests have been added to cover changes.

This fix is related to 28497.

A follow up to this PR will be done once this PR is merged.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-02 20:08:49 -08:00
Yong Tang
8a226ed643 Add ID field for docker plugin ls
This fix tries to address the enhancement proposed in 28708 to display
ID field for the output of `docker plugin ls`.

This fix add `ID` field to the output of `docker plugin ls`

Related docs has been updated.

This fix fixes 28708.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-02 13:42:50 -08:00
Yong Tang
90bb2cdb9f Support plugins in docker inspect
This fix tries to address the proposal raised in 28946
to support plugins in `docker inspect`.

The command `docker inspect` already supports
"container", "image", "node", "network", "service", "volume", "task".
However, `--type plugin` is not supported yet at the moment.

This fix address this issue by adding the support of `--type plugin`
for `docker inspect`.

An additional integration test has been added to cover the changes.

This fix fixes 28946.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-02 11:33:29 -08:00