Compare commits

..

1095 Commits

Author SHA1 Message Date
87847530f7 Merge pull request #209 from docker/ver-ga
[17.07] bump version to 17.07.0-ce
2017-08-29 10:38:08 -07:00
012d2b146d Merge pull request #210 from docker/cl-1707
[17.07] update changelog for 17.07.0
2017-08-29 10:37:55 -07:00
2d14ddae04 update changelog for 17.07.0
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-28 16:01:05 -07:00
1f6cab8789 bump version to 17.07.0-ce
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-28 15:58:55 -07:00
fe143e3bbc Merge pull request #203 from andrewhsu/rc4
[17.07] bump version to 17.07.0-ce-rc4
2017-08-22 15:16:12 -07:00
2044d9fe72 Merge pull request #204 from andrewhsu/cl-1707
[17.07] update changelog for latest 17.07 fix
2017-08-22 15:15:46 -07:00
3b7644dd7b Merge pull request #202 from andrewhsu/fix-diff-path-1707
[17.07] backport fix for removing diff path
2017-08-22 15:14:29 -07:00
fe06a9714c update changelog for latest 17.07 fix
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-22 12:01:20 -07:00
80b181d75e bump version to 17.07.0-ce-rc4
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-22 11:55:08 -07:00
121aa471b1 Fix error removing diff path
In d42dbdd3d48d0134f8bba7ead92a7067791dffab the code was re-arranged to
better report errors, and ignore non-errors.
In doing so we removed a deferred remove of the AUFS diff path, but did
not replace it with a non-deferred one.

This fixes the issue and makes the code a bit more readable.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 276b44608b04f08bdf46ce7c816b1f744bf24b7d)
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-22 11:44:45 -07:00
665d244001 Merge pull request #196 from andrewhsu/fix-lock
[17.07] vndr libnetwork to bring in lock fix
2017-08-16 17:19:43 -07:00
b6c875c8bb vndr libnetwork to bring in lock fix
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-16 15:05:59 -07:00
3f7ca09fc6 Merge pull request #193 from andrewhsu/bump-rc3
[17.07] bump version to 17.07.0-ce-rc3
2017-08-15 11:00:43 -07:00
a9aafcc8d3 Merge pull request #192 from andrewhsu/cl
[17.07] update changelog for 17.07.0-ce-rc3
2017-08-15 11:00:24 -07:00
6224485fba Merge pull request #194 from andrewhsu/fix-slash
[17.07] backport Fix requests for docker host ending with slash
2017-08-14 18:13:49 -07:00
a8a6fce600 sync components/engine/client changes with cli vendor
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-14 17:57:55 -07:00
9fc218c23a Merge pull request #190 from andrewhsu/ln-fix-peer
[17.07] vndr libnetwork to bump_17.07 to fix peerDeleteOp
2017-08-14 17:33:11 -07:00
fbd80d2af6 Fix requests for docker host ending with slash
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>(cherry picked from commit 823e88d4c4298c38130b9a387a45c47cf957a931)
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-14 15:36:10 -07:00
29fda6bf9b add experimental note for swarm plugins
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-08-14 14:33:07 -07:00
4ba586edd7 bump version to 17.07.0-ce-rc3
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-14 19:30:58 +00:00
82e46a2208 update changelog for 17.07.0-ce-rc3
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-14 19:28:47 +00:00
068b4a5b06 vndr libnetwork to bump_17.07 to fix peerDeleteOp
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-14 09:32:43 -07:00
92d80a6743 Merge pull request #188 from vieux/hide_swarm_p
[17.07] backport for Hide swarm plugins behind experimental flag
2017-08-14 09:05:56 -07:00
e1df46d2e2 hide swarm plugins behind experimental flag
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
(cherry picked from commit 493002021094d72d405e1cd5bfa10b8080f67920)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-08-09 08:57:18 -07:00
36ce6055c2 Merge pull request #186 from fcrisciani/ln-vnd-17.07
[17.07] vndr libnetwork to latest bump_17.07
2017-08-07 16:36:51 -07:00
c867dee41e [17.07] vndr libnetwork to latest bump_17.07
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-08-07 12:00:47 -07:00
82a59cdb2c Merge pull request #183 from andrewhsu/bump
bump version to 17.07.0-ce-rc2
2017-08-04 17:37:17 -07:00
282553a460 bump version to 17.07.0-ce-rc2
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-04 17:36:17 -07:00
a060b0ab9e Merge pull request #177 from thaJeztah/17.07-backport-stack-host-bridge-nets
[17.07] backport Skip inspect of built-in networks on stack deploy
2017-08-04 17:22:57 -07:00
49d3c0ffd5 Merge pull request #175 from vieux/fix_api_server_null
[17.07] backport Fix api server null pointer def on inspect/ls null ipam-driver networks
2017-08-04 17:01:56 -07:00
eb50cc77fa Merge pull request #176 from vieux/fix_make_plu
[17.07] backport Make plugins dir private
2017-08-04 17:01:07 -07:00
ef6b38478e Merge pull request #168 from thaJeztah/17.07-backport-keep-alive
[17.07] Enable TCP Keep-Alive in Docker client
2017-08-04 16:53:36 -07:00
4b977fe32c Merge pull request #181 from andrewhsu/v-ln
[17.07] vndr libnetwork to latest bump_17.07
2017-08-04 16:52:59 -07:00
ef0887e6d2 Merge pull request #182 from andrewhsu/make-vendor
[17.07] Add make vendor target
2017-08-04 16:30:21 -07:00
9be51c7a8e Merge pull request #143 from cpuguy83/cherry-pick-33960-17.07
[17.07] Fix error handling with not-exist errors on remove
2017-08-04 15:56:27 -07:00
6b8965d92f Merge pull request #152 from thaJeztah/17.07-backport-fix-awslogs
[17.07] Fix awslogs driver repeating last event - #34292
2017-08-04 15:55:22 -07:00
b7fcd3ebd2 Merge pull request #153 from thaJeztah/17.07-backport-fix-releaseableLayer-handling
[17.07] Fixing releaseableLayer handling of layer streams and mounts.
2017-08-04 15:54:13 -07:00
e5b51b4933 Merge pull request #155 from thaJeztah/17.07-backport-plugable-secret-api-docs
[17.07] backport plugable secret api docs
2017-08-04 15:52:48 -07:00
608cc09fab Merge pull request #170 from thaJeztah/17.07-docs-cherry-picks
[17.07] docs cherry picks
2017-08-04 15:49:00 -07:00
8cc93939f4 Merge pull request #178 from thaJeztah/17.07-backport-avoid-recursive-rlock
[17.07] cluster: Avoid recursive RLock
2017-08-04 15:45:07 -07:00
15bcae1956 vndr libnetwork to latest bump_17.07
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-04 14:29:19 -07:00
b159375e54 Add make vendor target
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 21205dab24)
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-08-04 14:17:35 -07:00
d66b5d38da Merge pull request #172 from vieux/fix-delete-container
[17.07] backport Fix delete container
2017-08-04 14:04:01 -07:00
4a06fe683e Merge pull request #174 from vieux/fix_changing_get_network
[17.07] backport Changing the get network request to...
2017-08-04 13:42:17 -07:00
f0d4715ce2 Merge pull request #173 from vieux/fix-pass-driver
[17.07] backport Fixing issue with driver opt not passed to drivers
2017-08-04 13:23:31 -07:00
4fd052876a cluster: Avoid recursive RLock
GetTasks can call GetService and GetNode with the read lock held. These
methods try to aquire the read side of the same lock. According to the
sync package documentation, this is not safe:

> If a goroutine holds a RWMutex for reading, it must not expect this or
> any other goroutine to be able to also take the read lock until the
> first read lock is released. In particular, this prohibits recursive
> read locking. This is to ensure that the lock eventually becomes
> available; a blocked Lock call excludes new readers from acquiring the
> lock.

Fix GetTasks to use the lower-level getService and getNode methods
instead. Also, use lockedManagerAction to simplify GetTasks.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
(cherry picked from commit bd4f66c8f1f6ad4a2f228a957f293bc157e13d9c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-04 11:53:09 +02:00
9097af4c13 Skip inspects of built-in networks on stack deploy
Signed-off-by: Alex Mavrogiannis <alex.mavrogiannis@docker.com>
(cherry picked from commit 7f53c99dfe)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-04 11:16:44 +02:00
9ea6d317bb Make plugins dir private.
This prevents mounts in the plugins dir from leaking into other
namespaces which can prevent removal (`device or resource busy`),
particularly on older kernels.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 0c2821d6f2de692d105e50a399daa65169697cca)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-08-03 18:44:55 -07:00
67dc2b7dac Fix api server null pointer def on inspect/ls null ipam-driver networks
- When a network is created with the null ipam driver, docker api server
  thread will deference a nil pointer on `docker network ls` and on
  `docker network inspect <nw>`. This because buildIpamResource()
  assumes a gateway address is always present, which is not correct.

Signed-off-by: Alessandro Boch <aboch@tetrationanalytics.com>
(cherry picked from commit beebfc0cf6240c8af511eb4d7e29314c8de6ddf2)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-08-03 18:42:09 -07:00
4c81d47fbc Changing the get network request to return swarm scope predefined networks
Starting 17.06 swarm service create supports service creates with predefined
networks like host and bridge. Due to the nature of the feature, swarm manager
has a swarm scope predefined networks in addition to local scoped
predefined networks on all nodes. However network inspects for swarm scoped
predefined networks was not possible. The fix adds support for network inspect
for swarm scoped predefined networks.

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
(cherry picked from commit 5bfefb2d3662fa066ddf0d0e10cac93ee70f7ae8)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-08-03 18:38:15 -07:00
a16dcf95b6 Fixing issue with driver opt not passed to drivers
Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
(cherry picked from commit bcb55c62024419a2f8fa7679e1e068cc43425636)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-08-03 18:34:11 -07:00
2358487e8e container: Fix Delete on nonexistent container
Delete needs to release names related to a container even if that
container isn't present in the db. However, slightly overzealous error
checking causes the transaction to get rolled back. Ignore the error
from Delete on the container itself, since it may not be present.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
(cherry picked from commit 1d9546fc62c559dbcbb3dbdce40318fb7c4d67a2)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-08-03 18:23:06 -07:00
1e3666a731 Update API plugin response examples
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4735c7663201ce1bf618e2aa505d7813a331be3f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-03 22:14:29 +02:00
1451e5e581 Add Infinit plugin
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
(cherry picked from commit 83e8551876)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-03 22:14:21 +02:00
fcf5a9d689 update service create and update options in commandline documentation
Signed-off-by: zebrilee <zebrilee@gmail.com>
(cherry picked from commit 5fe09164f5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-03 22:14:14 +02:00
3402a4fe4f modify foo by container in order to clarify the documentation
Signed-off-by: zebrilee <zebrilee@gmail.com>
(cherry picked from commit 2d5f9d83e7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-03 22:14:07 +02:00
598ea37b90 Docs: update filter options for docker container ps
The `is-task` filter was only documented in the usage
section, but this section is not used in the documentation.

This patch adds the missing filter, synchronises the
man page source, and does some slight rephrasing
and reformatting of the filters.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 46064f33f4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-03 22:14:00 +02:00
965908e8ce Enable TCP Keep-Alive in Docker client
Some network environments may have NATs, proxies, or gateways which
kill idle connections. There are many Docker API operations which may
be idle for long periods of time (such as ContainerWait and ContainerAttach)
and may result in unexpected connection closures or hangs if TCP keepalives
are not used.

This patch updates the default HTTP transport used by the Docker client
package to enable TCP Keep-Alive with a keep-alive interval of 30 seconds.
It also sets a connect timeout of 30 seconds.

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

(cherry picked from commit 2831a04cba)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-03 21:33:02 +02:00
1466b46335 Fix RestartPolicy default value
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit fc48b5529dca3907ade273921a14906be796e333)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-01 17:01:31 +02:00
bc27a5b53b Add API documentation for plugable secret backends
Documents the API changes introduced in

0304c98d85404fe75a1b4a35d3c111931e062f41 and
08f7cf05268782a0dd8e4c41a4cc65fdf78d09f2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c8dad44c326d9d2131f94babbc535e7f442db290)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-01 17:01:24 +02:00
c63ba3a05c Fixing releaseableLayer handling of layer streams and mounts.
releaseableLayer includes automatic handling for creating a read/write layer and mounting it on a call to Mount(), but then does not correspondingly unmount the layer before trying to delete it, which will fail for some graphdrivers. Commit on a releaseable layer also leaks the tarstream for the layer. To fix this, the stream close is deferred in Commit and releaseRWLayer now correctly handles unmounting the layer before trying to delete it.  In addition, the changes include better error handling in Release() to make sure that errors are returned to the caller for failures on read/write layers instead of being ignored.# Please enter the commit message for your changes. Lines starting

Signed-off-by: Stefan Wernli <swernli@ntdev.microsoft.com>
(cherry picked from commit 1d457999c4540aacda68f834bdb3c6f220ce3fd5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-01 14:16:46 +02:00
839e712162 Fix awslogs driver repeating last event - #34292
Signed-off-by: Justin Menga <justin.menga@gmail.com>
(cherry picked from commit 0fd5a0bab79f20f910cb7551ec34158a32e05f5a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-01 01:02:42 +02:00
48acee0beb Fix error handling with not-exist errors on remove
Specifically, none of the graphdrivers are supposed to return a
not-exist type of error on remove (or at least that's how they are
currently handled).

Found that AUFS still had one case where a not-exist error could escape,
when checking if the directory is mounted we call a `Statfs` on the
path.

This fixes AUFS to not return an error in this case, but also
double-checks at the daemon level on layer remove that the error is not
a `not-exist` type of error.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit d42dbdd3d48d0134f8bba7ead92a7067791dffab)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-07-26 13:28:51 -04:00
8c4be39ddd Merge pull request #141 from andrewhsu/ver
bump version to 17.07.0-ce-rc1
2017-07-25 18:38:06 -07:00
450a1a63d7 bump version to 17.07.0-ce-rc1
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-07-25 18:35:19 -07:00
b3be2b02db Merge pull request #124 from vieux/17.07-changelog
[17.07.x] Changelog
2017-07-25 18:33:07 -07:00
3ddc583fc2 Merge pull request #139 from cyli/re-vendor-swarmkit-17.07
[17.07] Re-vendor swarmkit
2017-07-25 18:31:57 -07:00
b92b043ac1 Re-vendors swarmkit to include the following fix:
- https://github.com/docker/swarmkit/pull/2323 (fix for watch server being run only on leader)

Signed-off-by: Ying <ying.li@docker.com>
2017-07-25 16:16:43 -07:00
1c65e20e5b Merge pull request #136 from cyli/re-vendor-swarmkit-17.07
[17.07] Re-vendor swarmkit
2017-07-25 15:23:43 -07:00
1fef2502d2 Merge pull request #131 from vieux/backport-fix-live-restore
[17.07] Graceful upgrade of containerd and runc state files upon live-restore
2017-07-25 15:19:55 -07:00
edadfd04be Merge pull request #137 from seemethere/cherry_pick_packaging_3_11_40_41
[17.07] Cherry pick latest packaging commits
2017-07-25 14:02:47 -07:00
83e8a29ede Removes telemetry mentions from Fedora 26
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit a8c7e75bfd263b2f7445b06f749aba13aaeac789)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-25 11:29:40 -07:00
0ff00e73c9 End Ubuntu 16.10 (Yakkety) support
Ubuntu 16.10 (Yakkety) reached it's "End of Life" on July 20, 2017:
http://fridge.ubuntu.com/2017/07/20/ubuntu-16-10-yakkety-yak-end-of-life-reached-on-july-20-2017/

As such we are removing support for the distribution for future versions
of Docker packages.

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit 36cc14cd480879391eeb9f470417698618f4cdb3)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-25 10:31:41 -07:00
32709fc76b Update spec to align with new spec files
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit feb2f647c5570753a607b71bb476028c8d1b4e55)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-25 10:30:18 -07:00
95fa7a2d20 Update go version, add distro/suite tags
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit 26b1bd9f3da46b907021ae66d310405057e29634)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-25 10:30:18 -07:00
22f30a8bb1 build fedora 26 packages
Just released: https://docs.fedoraproject.org/en-US/Fedora/26/html/Release_Notes/

Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
(cherry picked from commit 412824b465d8334278bb9c02f0a5ee3d294826fd)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-25 10:30:16 -07:00
e5f33c5d16 Revert "Added the metrics plugin to the RPM/DEB packages"
This reverts commit ceac22bf2240df483b1d3bd3a19ac681e665f910.

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit bda73f99e455bd3f041ccc843f094186ca8b8623)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-25 10:20:14 -07:00
c203be7748 Tell build-deb to throw up errors
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit 3618e4aa262f154f79c804752d69110772e636a3)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-25 10:19:29 -07:00
b9b61ead5a Add raspbian deb packages
(cherry picked from commit 1c61fdcafc4f6fa0e41c267cd857d0b60d3a2dbd)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-25 10:19:20 -07:00
8ddc1eeedd Added the metrics plugin to the RPM/DEB packages
- centos
 - fedora
 - ubuntu
 - debian

Signed-off-by: Roberto Gandolfo Hashioka <roberto_hashioka@hotmail.com>
(cherry picked from commit ceac22bf2240df483b1d3bd3a19ac681e665f910)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-25 10:18:39 -07:00
1dd11b3bb6 Re-vendors swarmkit to include the following fixes:
- https://github.com/docker/swarmkit/pull/2288 (Allow updates of failed services with restart policy "none")
- https://github.com/docker/swarmkit/pull/2304 (Reset restart history when task spec changes)
- https://github.com/docker/swarmkit/pull/2309 (updating the service spec version when rolling back)
- https://github.com/docker/swarmkit/pull/2310 (fix for slow swarm shutdown)

Signed-off-by: Ying <ying.li@docker.com>
2017-07-24 18:01:58 -07:00
9e07b412c7 add 17.07 changelog
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-07-24 17:10:41 -07:00
1b065d3124 [engine] Graceful upgrade of containerd and runc state files upon live-restore
Vendors new dependency github.com/crosbymichael/upgrade

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 358c36e930)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-07-24 16:51:35 -07:00
bd4b12ce5d Merge pull request #128 from seemethere/cherry_pick_packaging_37
[17.07.x] Change make -C to a cd command
2017-07-24 14:57:23 -07:00
c249bb0aea Change make -C to a cd command
Tried out make -C in this scenario and it did not seem to function
correctly, changed to cd.

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit 3a548f8815d5308b197abea1e39f0a0a4939c4f2)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-24 14:36:41 -07:00
cb16f8905b Merge pull request #126 from seemethere/cherry_pick_moby_34206
[17.07.x] Add go-autogen to integration tests
2017-07-21 15:26:19 -07:00
c4d547ce61 Add go-autogen to integration tests
Integration test were failing in trial runs for docker-ce 17.07 due to
the lack of go-autogen being sourced in `hack/make.sh`. This re-adds
go-autogen to be sourced for test-integration-cli so that we can
actually run tests without the error found in:
https://github.com/moby/moby/pull/33857

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit 3cdd471cac8193c34d8483255065c6c28a7b1645)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-21 14:41:26 -07:00
00313efde4 Merge pull request #123 from seemethere/cherry_pick_packaging_25
[17.07] Add ubuntu-xenial aarch64 Dockerfile
2017-07-20 16:35:08 -07:00
8bd577e801 Add ubuntu-xenial aarch64 Dockerfile
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
(cherry picked from commit 94cbc76b701b8b108f6a337b1695bd664f441bdc)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-20 16:33:08 -07:00
24244c1083 Merge pull request #122 from seemethere/fix_1707_version
[17.07.x] Increment engine version to 17.07.0-dev
2017-07-20 15:20:35 -07:00
4ca7fba8e3 Increment engine version to 17.07
Release jobs will fail if the version files are out of sync due to how
`hack/make.sh` builds binaries (putting them into the version folder
according to `components/engine/VERSION` instead of the base `VERSION`
file)

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
2017-07-20 14:44:56 -07:00
74c07ebc84 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-07-20 00:22:07 +00:00
cc15b49a4c Merge pull request #33 from tophj-ibm/s390x-add-seccomp
[s390x] add seccomp buildtag for ubuntu-yakkety
Upstream-commit: 795c44b6edfd158443b9ce501130b2e9776ab04a
Component: packaging
2017-07-19 17:21:19 -07:00
d9af0bcff1 Merge component 'engine' from git@github.com:moby/moby master 2017-07-20 00:09:53 +00:00
d266af160b Merge component 'cli' from git@github.com:docker/cli master 2017-07-19 23:39:56 +00:00
21a816c87d Merge pull request #34183 from thaJeztah/api-changelog-add-volume-created-at
Update API history and example response for volume CreatedAt
Upstream-commit: 8299f1727884c7ec41f21e70906d5b3a39fa7feb
Component: engine
2017-07-19 22:13:34 +02:00
5febff914b Merge pull request #34172 from aaronlehmann/swagger-configs
api: Update swagger.yaml for configs
Upstream-commit: 86b77bd9ddb49ce943d987932694a6751d9de2a3
Component: engine
2017-07-19 22:09:31 +02:00
8830d4f1ff api: Update swagger.yaml for configs
Also fix bad reference to ServiceSpec.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: ea1d14a189d62df34427b037a6d043ae3028760b
Component: engine
2017-07-19 09:52:25 -07:00
edb54ff5f9 Merge pull request #34071 from FengtuWang/pause
Keep pause state when restoring container's status
Upstream-commit: 4309075610dc3c8e68237d399423325b8dd9f242
Component: engine
2017-07-19 17:49:38 +02:00
0112a044fc Update API history and example response for volume CreatedAt
This adds the new `CreatedAt` field to the API version history
and updates some examples to show this information.

The `CreatedAt` field was implemented in a46f757c4043031379362c5d6b3bad7562ab9fed

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 48a83a3a18185e0ad48737d448524670f8fac4bf
Component: engine
2017-07-19 16:18:08 +02:00
ba4262a451 Merge pull request #32453 from cpuguy83/default_enable_pprof
Enable pprof/debug endpoints by default
Upstream-commit: eb9e5cd14bbe9b21e1774d92e2023197869d7401
Component: engine
2017-07-19 16:13:12 +02:00
ae4cfec3e4 Merge pull request #34168 from Microsoft/jjh/dodgytest
Windows: Disable TestAttachTTYWithoutStdin
Upstream-commit: 24bb61145cf380f90435d02daa485c5921a51c67
Component: engine
2017-07-19 10:19:15 +02:00
d160314d93 Merge pull request #34171 from thaJeztah/fix-secrets-api-docs
Fix API docs for GET /secrets/{id}, GET /secrets
Upstream-commit: a2202d5d5d22dedd67734c468b02b43aade6385b
Component: engine
2017-07-19 10:18:09 +02:00
7145299da3 Merge pull request #356 from dnephin/fix-codeowners
Fix .github/CODEOWNERS patterns
Upstream-commit: 7f684c7512
Component: cli
2017-07-18 17:08:37 -07:00
e4c6e38322 Fix CODEOWNERS patterns.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: cea8b4f4f3
Component: cli
2017-07-18 18:25:55 -04:00
21d120121d Fix API docs for GET /secrets/{id}, GET /secrets
The swagger.yml defined these endpoints to return
a "ServiceSpec" instead of a "SecretSpec".

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: f6954bea9f28c62c50b88c895968045cf801aa81
Component: engine
2017-07-19 00:22:05 +02:00
416ca06159 Windows: Disable TestAttachTTYWithoutStdin
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: e4ec9195fed2f3653ec6d0a2b1c9ca6b0e2b9c37
Component: engine
2017-07-18 14:23:23 -07:00
b58bd71384 Merge pull request #34135 from tklauser/more-unix-fns
Replace manually written wrappers by functions from x/sys/unix
Upstream-commit: fa7db52e2603cefbf0faf4e5d525e48cfe4a3c52
Component: engine
2017-07-18 20:43:13 +02:00
7419227176 Merge pull request #351 from dnephin/misc-cleanup
Misc cleanup of dockerfiles and circleci
Upstream-commit: 257e113542
Component: cli
2017-07-18 10:44:51 -07:00
b069176a2d Merge pull request #34146 from kolyshkin/vasprintf
devmapper_wrapper.go: fix gcc warning
Upstream-commit: 72959fc2161fdcd785ad54a38cd03049250236fb
Component: engine
2017-07-18 12:46:23 -04:00
7c2dc55ca3 Remove unnecessary prune function aliases.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: ff350a04cb
Component: cli
2017-07-18 12:25:45 -04:00
29e4b6071d Cleanup dockerfiles and circle
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0f91d9e6c4
Component: cli
2017-07-18 12:22:28 -04:00
79a4b353ef Merge pull request #34157 from twistlock/plugable_secrets_backend
plugable secret backend
Upstream-commit: 0304c98d85404fe75a1b4a35d3c111931e062f41
Component: engine
2017-07-18 18:07:27 +02:00
c912542d4f Merge pull request #350 from thaJeztah/unexport-commands
Unexport subcommands
Upstream-commit: a14762c6d2
Component: cli
2017-07-18 17:17:01 +02:00
fa129caef8 Merge pull request #341 from thaJeztah/small-prune-refactor
Small refactor in system prune
Upstream-commit: 3209cb8da6
Component: cli
2017-07-18 10:45:21 -04:00
ea84db7e56 Unexport subcommands
These commands were only used as subcommands, so did
not have to be exported.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 9c7b0d74cd
Component: cli
2017-07-18 15:26:45 +02:00
7e5b932e43 Small refactor in system prune
Adapt "image prune" and "build cache prune" to have
the same signature as the other prune commands, so
that they can all be added to the "pruneFuncs" array.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 73163ee78b
Component: cli
2017-07-18 15:13:11 +02:00
6250958cd7 Merge pull request #315 from ripcurld0/nat_sort
Sort swarm stacks and nodes using natural sorting
Upstream-commit: 79e4d635ca
Component: cli
2017-07-18 15:01:11 +02:00
6db8c53375 Merge pull request #345 from vdemeester/remove-prune-package
Remove useless prune package 👼
Upstream-commit: 19efbc85f4
Component: cli
2017-07-18 14:46:53 +02:00
51e2eef57d Merge pull request #34002 from thaJeztah/carry-32483
Service privileges: API docs
Upstream-commit: 32ada4dcf12fe11e8d87820e851b8c2172761e29
Component: engine
2017-07-18 13:09:08 +02:00
988a5f28f9 pluggable secret backend
Fixing secret driver serialization issue from
08f7cf05268782a0dd8e4c41a4cc65fdf78d09f2

Signed-off-by: Liron Levin <liron@twistlock.com>
Upstream-commit: e3f920d2f147025634e12abd5af3a84f436ddad1
Component: engine
2017-07-18 12:45:44 +03:00
be624ce447 Merge pull request #34155 from thaJeztah/update-authors
Update authors and mailmap
Upstream-commit: c6fe39728f0918ab475dddccacc82d02ea6fac5f
Component: engine
2017-07-18 11:05:42 +02:00
4bd74593a1 Merge pull request #34085 from cpuguy83/tests_use_locally_built_plugin
Use local plugins, not from hub for tests
Upstream-commit: f9091195823dc409e7c0fff633c59f7a9998f4a7
Component: engine
2017-07-18 10:47:58 +02:00
59247b3492 Update authors and mailmap
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 6be41f3858522ac54f97b54a5011cda42828db39
Component: engine
2017-07-18 10:36:11 +02:00
b7e7973a5f Merge pull request #266 from jphuynh/shellcheck
Add shellcheck for bash completion
Upstream-commit: b75596e1e4
Component: cli
2017-07-18 09:59:07 +02:00
8dbc530b62 Remove useless prune package 👼
The `cli/command/prune` just does some aliasing of `Prune*` methods,
doesn't have any use.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 3f4d91508e
Component: cli
2017-07-18 09:49:02 +02:00
cc2a1a7847 Merge pull request #340 from thaJeztah/fix-dont-prune-build-cache
Fix: skip build-cache prune on unsupported versions
Upstream-commit: 277f4b997c
Component: cli
2017-07-18 09:41:37 +02:00
59f36f3793 devmapper_wrapper.go: fix gcc warning
I am getting the following warning from gcc when compiling the daemon:

> # github.com/docker/docker/pkg/devicemapper
> pkg/devicemapper/devmapper_wrapper.go: In function ‘log_cb’:
> pkg/devicemapper/devmapper_wrapper.go:20:2: warning: ignoring return
> value of ‘vasprintf’, declared with attribute warn_unused_result
> [-Wunused-result]
>  vasprintf(&buffer, f, ap);
>  ^

vasprintf(3) man page says if the function returns -1, the buffer is
undefined, so we should not use it. In practice, I assume, this never
happens so we just return.

Introduced by https://github.com/moby/moby/pull/33845 that resulted in
commit 63328c6 ("devicemapper: remove 256 character limit of libdm logs")

Cc: Aleksa Sarai <asarai@suse.de>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Upstream-commit: 7da12bcfa9db4d84b2c547bee93dafeaead15b16
Component: engine
2017-07-17 17:46:44 -07:00
00e1fa391a Merge pull request #34123 from twistlock/plugable_secrets_backend
pluggable secret backend
Upstream-commit: 08f7cf05268782a0dd8e4c41a4cc65fdf78d09f2
Component: engine
2017-07-17 19:00:30 -04:00
1549d1d8d9 Enable pprof/debug endpoints by default
Makes sure that debug endpoints are always available, which will aid in
debugging demon issues.

Wraps debug endpoints in the middleware chain so the can be blocked by
authz.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 408c7ade7008ca9b2181e12e51a01250a7a94413
Component: engine
2017-07-17 15:01:30 -04:00
2e0ee810bb Merge pull request #33886 from aaronlehmann/names-in-memdb
Store container names in memdb
Upstream-commit: 458f6712d4128cbf32675990ae3ad779e2972839
Component: engine
2017-07-17 14:16:41 -04:00
24fde7d000 Merge pull request #34134 from pims/use-const-key
Replaces fluentd-address string by constant
Upstream-commit: d9b785cf2e004bb0024f398014146e534b2cd8c5
Component: engine
2017-07-17 11:13:54 -04:00
2dc557d71e Fix: skip build-cache prune on unsupported versions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 6c3a448ecb
Component: cli
2017-07-17 11:55:35 +02:00
1490278683 loopback: use IoctlGetInt/IoctlSetInt from x/sys/unix
Use IoctlGetInt/IoctlSetInt from golang.org/x/sys/unix (where
applicable) instead of manually reimplementing them.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Upstream-commit: bedf09363cb7f2f59bf2b72fea0704351b9f5c8d
Component: engine
2017-07-17 10:37:42 +02:00
62a7e56d34 [pkg/term] use IoctlGetTermios/IoctlSetTermios from x/sys/unix
Use IoctlGetTermios/IoctlSetTermios from golang.org/x/sys/unix instead
of manually reimplementing them.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Upstream-commit: 6476504695284fcdc32b5f7621cffca22746e67d
Component: engine
2017-07-17 10:37:42 +02:00
4437cd08db sysinfo: use Prctl() from x/sys/unix
Use unix.Prctl() instead of manually reimplementing it using
unix.RawSyscall. Also use unix.SECCOMP_MODE_FILTER instead of locally
defining it.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Upstream-commit: 6c9d715a8c64a7c782b8c7b57925e1dc19b29517
Component: engine
2017-07-17 10:37:42 +02:00
a03e065e9a Merge pull request #34106 from tonistiigi/fix-tar-prefix-header
Fix tar prefix header
Upstream-commit: 97e730ae57de11939d65e5cbef72fbec83f24bcc
Component: engine
2017-07-17 09:40:39 +02:00
tim
812c72c3da Replaces fluentd-address string by constant
Signed-off-by: tim <tim@fewagainstmany.com>
Upstream-commit: cb972b1515428fd7a8ef573fa65af08a6fef669c
Component: engine
2017-07-16 23:06:57 -07:00
ed052d78fd pluggable secret backend
This commit extends SwarmKit secret management with pluggable secret
backends support.

Updating the work in
[swarmkit](docker/swarmkit@eebac27434) for
pluggable secret backend and adding the
driver parameter to `SecretSpec`.

Remaining work:
- [ ] CLI support (docker/cli)
- [ ] api in [plugin helpers](docker/go-plugins-helpers))
- [ ] Reference plugin
- [ ] Documenation (after cli work)

Signed-off-by: Liron Levin <liron@twistlock.com>
Upstream-commit: 7d45cafd5746e847e58078aa2fbdde57b5f49fa4
Component: engine
2017-07-15 16:50:02 +03:00
72d8e914bc Merge pull request #331 from yuexiao-wang/docker-search-filters
Fix filters displaying for docker search
Upstream-commit: 03a46a66bd
Component: cli
2017-07-14 23:30:43 -07:00
c6415e10ce Merge pull request #314 from allencloud/add-filter-scope-for-events
docs: add filter scope for command events and more cluster events
Upstream-commit: 47370b4863
Component: cli
2017-07-14 23:28:55 -07:00
759b91249c Merge pull request #338 from thaJeztah/carry-moby-32483
Service privileges: CLI reference docs & completion
Upstream-commit: 9c9fe9bf1f
Component: cli
2017-07-14 23:26:52 -07:00
42cbae8c65 Service privileges: CLI reference docs & completion
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 5cc7ac2990
Component: cli
2017-07-14 22:30:47 -07:00
c456febc9c docs: add filter scope for command events and more cluster events
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 8639c9baf8
Component: cli
2017-07-15 09:17:35 +08:00
6d6adf9904 Merge pull request #333 from dnephin/docs-arg-in-from-take-2
Improve docs about ARG in FROM
Upstream-commit: fe24806ee5
Component: cli
2017-07-14 18:04:53 -07:00
5b6e1a1aa3 Service privileges: API docs
This documents the Service privileges
API changes, that were added in:
091b5e68ea735bf4e8ece708bbc8c413a32eab73

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: d0a8e73e7b60f61db0c3799643aaccbbf33f3601
Component: engine
2017-07-14 17:04:26 -07:00
bab96155c7 Merge component 'engine' from git@github.com:moby/moby master 2017-07-14 21:15:01 +00:00
d85711734b More about ARG and build stages.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: ad5d035988
Component: cli
2017-07-14 16:59:21 -04:00
0b42de4e27 Clarify docs about ARG in FROM
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 2880030814
Component: cli
2017-07-14 16:55:42 -04:00
1a59a831b3 Merge component 'cli' from git@github.com:docker/cli master 2017-07-14 20:04:39 +00:00
c2eba39c13 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-07-14 20:03:09 +00:00
5d957152ba Testing: Use local plugins, not from hub
Use the (new) plugin fixtures for plugin tests rather than pulling
plugins from hub.

This removes the restriction for platforms/archs since plugin binaries
get built in the test environment.

Future work would be to add test plugins for the various subsystems so
tests that are actually using plugins (e.g. volumes, networks) can be
ported to use the fixtures as well.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 15a538a627e1d0898862c9e6ca7472cd7fb517ce
Component: engine
2017-07-14 13:24:14 -04:00
8061bcd2a7 archive: add test for prefix header
With docker-17.06.0 some images pulled do not extract properly. Some files don't appear in correct directories. This may or may not cause the pull to fail. These images can't be pushed or saved. 17.06 is the first version of Docker built with go1.8.

Cause

There are multiple updates to the tar package in go1.8.

https://go-review.googlesource.com/c/32234/ disables using "prefix" field when new tar archives are being written. Prefix field was previously set when a record in the archive used a path longer than 100 bytes.

Another change https://go-review.googlesource.com/c/31444/ makes the reader ignore the "prefix" field value if the record is in GNU format. GNU format defines that same area should be used for access and modified times. If the "prefix" field is not read, a file will only be extracted by the basename.

The problem is that with a previous version of the golang archive package headers could be written, that use the prefix field while at the same time setting the header format to GNU. This happens when numeric fields are big enough that they can not be written as octal strings and need to be written in binary. Usually, this shouldn't happen: uid, gid, devmajor, devminor can use up to 7 bytes, size and timestamp can use 11. If one of the records does overflow it switches the whole writer to GNU mode and all next files will be saved in GNU format.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 4a3cfda45e37b81211fbfbf0c45dbe64860a3ad0
Component: engine
2017-07-14 10:20:48 -07:00
a50b8e5956 Merge pull request #335 from coolljt0725/add_env
Add DOCKER_BUILD_ARGS to support build with proxy
Upstream-commit: 0c8d401cd8
Component: cli
2017-07-14 11:41:44 -04:00
19bca77267 Merge pull request #34077 from justincormack/mount_remount_opts
In the case of remounting with changed data, need to call mount
Upstream-commit: f7ce35f47b1b8e029d7e572ef333cabba1b08e5b
Component: engine
2017-07-14 09:58:30 -04:00
0667ef33f8 Add DOCKER_BUILD_ARGS to support build with proxy
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 7d8681fadb
Component: cli
2017-07-14 05:20:18 -04:00
5aee375eb4 Fix inconsistencies
Signed-off-by: Jean-Pierre Huynh <jean-pierre.huynh@ounet.fr>
Upstream-commit: d7748e1b01
Component: cli
2017-07-14 09:24:46 +01:00
c8dfc96c37 Merge pull request #324 from cyphar/libdm-debug-flag-docs
docs: add documentation for dm.libdm_log_level
Upstream-commit: de4c546b7e
Component: cli
2017-07-14 00:58:38 -07:00
240df15e94 Merge pull request #34076 from yastij/33679-renaming-id-meth
renaming id() to state clearly that it's related to the networkAttachment
Upstream-commit: ce0ef9568d945b3d16442906a428b6f80fedc4dd
Component: engine
2017-07-14 00:29:09 -07:00
becbfbd6d3 docs: add documentation for dm.libdm_log_level
This is a new option added specifically to allow for debugging of bugs
in Docker's storage drivers or libdm itself.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
Upstream-commit: c7710819a5
Component: cli
2017-07-14 16:52:33 +10:00
fd5e2f635f Merge pull request #34089 from tonistiigi/builder-report-2017-07-10
Add builder dev report for 2017-07-10
Upstream-commit: 93494237df7ddcd78738b68d5c48ed08e3755423
Component: engine
2017-07-13 23:25:57 -07:00
0393b35079 Merge pull request #34 from andrewhsu/check-clean
check if build dir exists before chown
Upstream-commit: 6829cb8fdb1ffad738d9742329bf83de1b2aad8b
Component: packaging
2017-07-13 21:50:19 -07:00
16b3113441 check if build dir exists before chown
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: 46dd23f1fc2863741783f0584dad1a42815e5438
Component: packaging
2017-07-14 04:35:47 +00:00
80e097613a Merge pull request #34063 from dnephin/fix-builder-no-such-layer
Fix multiple `COPY --from` in multistage builds
Upstream-commit: 1daa10301acfe0742dd852dfb8603c48afdaa1ee
Component: engine
2017-07-14 12:19:19 +09:00
f708c1ef17 vendor: add archive/tar
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 72df48d1ad417401a5ce0a7ee82a3c8ba33e091c
Component: engine
2017-07-13 19:08:19 -07:00
d96f150bfb Fix filters displaying for docker search
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: bd64ad25fb
Component: cli
2017-07-14 08:56:20 +08:00
b9deee44fd Merge pull request #33969 from Microsoft/jjh/lifetime
LCOW: Service VM lifetime changes
Upstream-commit: f22cecf9297a467f20bf49bc1c7aef5d2ee3a59c
Component: engine
2017-07-13 15:51:21 -07:00
6da354bd2c Merge pull request #10 from seemethere/reflective_alpine_images
Add reflective alpine images to other components
Upstream-commit: f373edf0ac49203be0b8dd66f75237e18927c553
Component: packaging
2017-07-13 15:29:20 -07:00
480f1b0a2a ALPINE -> ALPINE_IMG
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: ee25bc2379126a75116ce66daffda6c7d3f41d42
Component: packaging
2017-07-13 15:19:22 -07:00
fa401fa1b5 Add reflective alpine images to other components
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 0435cef6a945dc1c57b51cb24b36aaf66be8d8cc
Component: packaging
2017-07-13 15:16:51 -07:00
33db8883ea Fix code location when mounting to docker-cli-shell-validate
Signed-off-by: Jean-Pierre Huynh <jean-pierre.huynh@ounet.fr>
Upstream-commit: ffe8509663
Component: cli
2017-07-13 22:24:08 +01:00
cbcb37cde8 Update dockerfile path for CicleCI build
Signed-off-by: Jean-Pierre Huynh <jean-pierre.huynh@ounet.fr>
Upstream-commit: 501cf0e6d1
Component: cli
2017-07-13 22:24:08 +01:00
dc6c9cd967 Reword to remove ambiguity with go validate
Signed-off-by: Jean-Pierre Huynh <jean-pierre.huynh@ounet.fr>
Upstream-commit: 2e7d24cae8
Component: cli
2017-07-13 22:24:08 +01:00
a61c7f009e Add shellcheck for bash completion
Signed-off-by: Jean-Pierre Huynh <jean-pierre.huynh@ounet.fr>
Upstream-commit: b2fc35aefa
Component: cli
2017-07-13 22:24:08 +01:00
52cbacdf18 container: Use wrapper to ensure commit/abort happens
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 0e57eb95c5989d0f4e93b7d12efe735a6287781b
Component: engine
2017-07-13 12:35:03 -07:00
975e5b0723 container: Abort transactions when memdb calls fail
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: bc3209bc156fc5a5bc6e76e5f79a64c60e9a5f7b
Component: engine
2017-07-13 12:35:02 -07:00
107190981d Store container names in memdb
Currently, names are maintained by a separate system called "registrar".
This means there is no way to atomically snapshot the state of
containers and the names associated with them.

We can add this atomicity and simplify the code by storing name
associations in the memdb. This removes the need for pkg/registrar, and
makes snapshots a lot less expensive because they no longer need to copy
all the names. This change also avoids some problematic behavior from
pkg/registrar where it returns slices which may be modified later on.

Note that while this change makes the *snapshotting* atomic, it doesn't
yet do anything to make sure containers are named at the same time that
they are added to the database. We can do that by adding a transactional
interface, either as a followup, or as part of this PR.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 1128fc1add66a849c12d2045aed39605e673abc6
Component: engine
2017-07-13 12:35:00 -07:00
9ed5ded98d LCOW: Service VM lifetime changes
Signed-off-by: John Howard <jhoward@microsoft.com>

This changes the LCOW driver to support both global SVM lifetime and
per-instance lifetime. It also corrects the scratch implementation.
Upstream-commit: 76b0d4819a50c50edd79890db0b92eb96c8d46e6
Component: engine
2017-07-13 11:09:43 -07:00
a100224db8 Add builder dev report for 2017-07-10
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 2689f9cc0b45dfbacf52f8f08a7b5f4abb286427
Component: engine
2017-07-13 09:30:13 -07:00
5103d2f4f1 [s390x] add seccomp buildtag for ubuntu-yakkety
Adds the seccomp buildtag for ubuntu-yakkety on s390x

Note: s390x requires libseccomp-dev 2.3.1 at the moment which is only available
only yakkety and later. This change is also consistent with the s390x yakkety
deb dockerfile in moby/moby.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: 86c865f571eb9479052e19920fbb0efe7f54fd25
Component: packaging
2017-07-13 11:57:53 -04:00
d4d72fe32c In the case of remounting with changed data, need to call mount
The case where we are trying to do a remount with changed filesystem specific options was missing,
we need to call `mount` as well here to change those options.

See #33844 for where we need this, as we change `tmpfs` options.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
Upstream-commit: 3a1ab5b479ce843648cf676fbaaf2bec9e040dce
Component: engine
2017-07-13 15:48:58 +01:00
a090086ff6 Sort swarm stacks and nodes using natural sorting
This commit changes the order stacks and nodes are displayed.
For example, running "docker stack ls" is expected to
display the following list:

NAME          SERVICES
service-1     1
service-2     1
service-10    1

However, currently this is what is printed:

NAME          SERVICES
service-1     1
service-10    1
service-2     1

To fix this, "docker stack ls" and "docker node ls" are using
natural sorting to make it more human readable.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 1333b49194
Component: cli
2017-07-13 14:33:02 +03:00
3c42375fa5 Merge pull request #206 from dnephin/why-cross-so-slow
Faster CI
Upstream-commit: e3746d388e
Component: cli
2017-07-13 09:36:18 +02:00
f68d310a1b Merge pull request #32881 from coolljt0725/fix_exec_faild
Enable inspect exec if container is pause/restarting/non-running
Upstream-commit: 53a75ee05072cf5e59e9fb5b9e5cc5fb91fdb5be
Component: engine
2017-07-12 19:29:27 -07:00
2015772003 Merge pull request #34027 from cpuguy83/15853_allow_stopping_paused_container
Allow stopping of paused container
Upstream-commit: 6fdb2fb069b985f244eb227828b00a940ee9de84
Component: engine
2017-07-13 10:16:46 +08:00
0e754d487a Merge pull request #33539 from tklauser/x-sys-unix-symlink-xattrs
Use symlink xattr functions from x/sys/unix
Upstream-commit: 96bf279c7d03bc20dd2626535ff77d7efd66dd07
Component: engine
2017-07-12 18:04:33 -07:00
a6bf694e20 Merge pull request #33845 from cyphar/devicemapper-show-me-your-logs
devicemapper: rework logging and add --storage-opt dm.libdm_log_level
Upstream-commit: 00b218216d8a2075bf7200df74aa07b749f72f34
Component: engine
2017-07-12 17:46:14 -07:00
8e0ce0ecdb Merge pull request #33877 from rhvgoyal/sync-removal
devicemapper: Wait for device removal if deferredRemoval=true and deferredDeletion=…
Upstream-commit: e04dbe5ac287c2a856b7c96972d931ee5f0e288f
Component: engine
2017-07-12 17:35:45 -07:00
38d61f1225 Merge pull request #271 from tych0/password-stdin
Password stdin
Upstream-commit: ae38f202bb
Component: cli
2017-07-12 17:08:11 -07:00
e7e9eef224 Merge pull request #328 from cyli/de-duplicate-CAcert-flag
Fix warning in docker CLI when `swarm ca` is called with flags other than `--rotate`
Upstream-commit: dcd788b100
Component: cli
2017-07-12 16:45:50 -07:00
ac7952530f Fix warning in docker CLI when swarm ca --ca-cert, etc. flags are passed,
and add a test.

Signed-off-by: Ying Li <ying.li@docker.com>
Upstream-commit: 4615c92f66
Component: cli
2017-07-12 14:56:28 -07:00
34e1a128cc Merge pull request #329 from dnephin/fix-linter-master
Update gometalinter
Upstream-commit: 6d74d8c13c
Component: cli
2017-07-12 13:21:24 -07:00
5f448ae97b Update gometalinter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 7a8f75a25a
Component: cli
2017-07-12 15:21:41 -04:00
b492ded3c0 Fix multiple copy from
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b50ade0bfb67dae7867f4f5c3da12c1f778b6c7e
Component: engine
2017-07-12 12:36:03 -04:00
0ca3fff735 Merge pull request #326 from dnephin/fix-merged-pr-conflicts
Fix test and lint failures on master
Upstream-commit: 25d9594f0b
Component: cli
2017-07-12 09:34:14 -07:00
cdbad2a1c4 Fix test and lint failures
Split test cases.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f27934376d
Component: cli
2017-07-12 11:37:35 -04:00
7aed75f09c Allow stopping of paused container
When a container is paused, signals are sent once the container has been
unpaused.
Instead of forcing the user to unpause a container before they can ever
send a signal, allow the user to send the signals, and in the case of a
stop signal, automatically unpause the container afterwards.

This is much safer than unpausing the container first then sending a
signal (what a user is currently forced to do), as the container may be
paused for very good reasons and should not be unpaused except for
stopping.
Note that not even SIGKILL is possible while a process is paused,
but it is killed the instant it is unpaused.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c3feb046b9b1eb606cc7e853d020799eb3800e0e
Component: engine
2017-07-12 10:35:48 -04:00
165659798d renaming id() to state clearly that it's related to the networkAttachement container target
Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>
Upstream-commit: 27c0131a43b1f4956446467273e82826264d6c35
Component: engine
2017-07-12 15:58:31 +02:00
5eaf5cc8fa Merge pull request #33887 from thaJeztah/update-version-error
Fix NewVersionError() for clients using default version
Upstream-commit: 45cad73ea8abc5e87d5db1a4a47c8565531d769f
Component: engine
2017-07-12 15:24:00 +02:00
6ef5605557 system: Use symlink xattr functions from x/sys/unix
Use the symlink xattr syscall wrappers Lgetxattr and Lsetxattr from
x/sys/unix (introduced in golang/sys@b90f89a) instead of providing own
wrappers. Leave the functionality of system.Lgetxattr intact with
respect to the retry with a larger buffer, but switch it to use
unix.Lgetxattr. Also leave system.Lsetxattr intact (even though it's
just a wrapper around the corresponding function from unix) in order to
keep moby building for !linux.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Upstream-commit: 4d966409bc7033e3bebe7deb921d8be8249f8d18
Component: engine
2017-07-12 14:52:42 +02:00
ea0a9a0e13 [pkg/term] temporarily use STD_*_HANDLE from syscall again
Due to the CL https://go-review.googlesource.com/c/39608/ in
x/sys/windows which changed the definitions of STD_INPUT_HANDLE,
STD_OUTPUT_HANDLE and STD_ERROR_HANDLE, we get the following failure
after re-vendoring x/sys/windows:

  07:47:01 # github.com/docker/docker/pkg/term
  07:47:01 pkg/term/term_windows.go:82: constant 4294967286 overflows int
  07:47:01 pkg/term/term_windows.go:88: constant 4294967285 overflows int
  07:47:01 pkg/term/term_windows.go:94: constant 4294967284 overflows int
  07:47:12 Build step 'Execute shell' marked build as failure

Temporarily switch back pkg/term to use these constants from the syscall
package and add a comment about it.

To really fix this, go-ansiterm should probably be switched to use
x/sys/windows.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Upstream-commit: ef5252fc5dcd83d1b8dfe173a68691c8a63e7e4a
Component: engine
2017-07-12 14:52:42 +02:00
520019f676 Windows: fix build after re-vendoring golang.org/x/sys
Due to the CL https://go-review.googlesource.com/c/39608/ in
x/sys/windows which changed the definitions of STD_INPUT_HANDLE,
STD_OUTPUT_HANDLE and STD_ERROR_HANDLE, we get the following failure
in cmd/dockerd/service_windows.go after re-vendoring x/sys/windows:

  06:29:57 # github.com/docker/docker/cmd/dockerd
  06:29:57 .\service_windows.go:400: cannot use sh (type int) as type uint32 in argument to windows.GetStdHandle

Fix it by adding an explicit type conversion when calling
windows.GetStdHandle.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Upstream-commit: e769da88e6c6e94a397822dd8962cbcb83a402a0
Component: engine
2017-07-12 14:52:42 +02:00
8658bf36a0 Merge pull request #323 from dnephin/add-code-owners
Add a new CODEOWNERS file, and add a few owners
Upstream-commit: bb795aa7af
Component: cli
2017-07-12 13:28:24 +02:00
27200496d4 Merge pull request #34067 from thaJeztah/bump-image-spec
bump image-spec to 372ad780f63454fbbbbcc7cf80e5b90245c13e13
Upstream-commit: 94260ccb1dad0b49c7642db07aece5112b316ba0
Component: engine
2017-07-12 12:19:39 +02:00
e4f148de96 Merge pull request #277 from thaJeztah/dont-remove-what-isnt-there
Don't attempt to remove unsupported resources on older daemon
Upstream-commit: 87345ed117
Component: cli
2017-07-12 10:43:54 +02:00
23cc76ac7e Keep pause state when restoring container's status
Do not change pause state when restoring container's
status, or status in docker will be different with
status in runc.

Signed-off-by: Fengtu Wang <wangfengtu@huawei.com>
Upstream-commit: 977c4046fd2147d7c04f4b513a94138013ca0dd6
Component: engine
2017-07-12 16:25:17 +08:00
316c35cc99 Merge pull request #299 from dnephin/less-verbose-fake-cli
Less verbose fake cli
Upstream-commit: fa7687a362
Component: cli
2017-07-12 09:56:43 +02:00
a05235a1e0 Merge pull request #322 from dnephin/pin-tools
Pin all tools used in the Dockerfiles
Upstream-commit: 8b451c598f
Component: cli
2017-07-12 08:58:33 +02:00
9083f94772 vendor: re-vendor golang.org/x/sys
Update golang.org/x/sys to 739734461d1c916b6c72a63d7efda2b27edb369f in
order to get the Lgetxattr, Llistxattr, Lremovexattr and Lsetxattr
syscall wrappers. These will be used in a successive commit to replace
the wrappers in libcontainer/system/xattr_linux.go.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Upstream-commit: bd13a5a9e0e3bfad8bdc533cac45ec4bd17c1c33
Component: engine
2017-07-12 08:26:51 +02:00
4f75fb4d4c bump image-spec to 372ad780f63454fbbbbcc7cf80e5b90245c13e13
this commit matches what's used in SwarmKit

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 9fc66ec869ecd963d7a30b96f5c0b1de69cf5090
Component: engine
2017-07-11 20:52:17 -07:00
bd835f3c9e Merge pull request #34061 from cyli/re-vendor-swarmkit
Re-vendor swarmkit. 
Upstream-commit: c0e6da7637491886904725c2fcec9db6ec261af4
Component: engine
2017-07-11 20:30:56 -07:00
322987e0f5 Merge pull request #34065 from allencloud/add-cluster-events-change
add cluster events change in version_history.md
Upstream-commit: e5862d42b372110c4530ba7afb579801ddafd553
Component: engine
2017-07-11 20:28:05 -07:00
c30b5760e3 Merge pull request #34032 from allencloud/support-config-event-in-cluster
make engine support cluster config event
Upstream-commit: 334702ab1fa8d3d6c64f3c41d80752c7b4196357
Component: engine
2017-07-11 20:25:19 -07:00
52c2abd279 Merge pull request #34004 from yummypeng/fix-docker-stats-hang
Return an empty stats if "container not found"
Upstream-commit: c8a2596d676a815cc17162f178869be4aeb4b301
Component: engine
2017-07-11 20:10:17 -07:00
b4af05d241 add cluster events change in version_history.md
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: e9da15a6603f288a4c0005fc8f4161b45390e26b
Component: engine
2017-07-12 09:25:30 +08:00
3a04c6bfdb add config event in swagger.yml
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: c8d6477e5a359d30cdf0a59cdbfffc158a1d9388
Component: engine
2017-07-12 08:48:14 +08:00
d73fe10e9e Update some tests to remove unnecessary buffers.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 42a3800783
Component: cli
2017-07-11 17:52:43 -04:00
b0276ff8b1 Add a new CODEOWNERS file, and add a few owners.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 91a5efd882
Component: cli
2017-07-11 17:40:25 -04:00
fe328d4b30 Merge pull request #33399 from tophj-ibm/move-all-of-pkg-to-syscall
[project] Switch most syscalls to golang.org/x/sys
Upstream-commit: 54251b53d7081f1471c0a2cb23fd4e198e71bd14
Component: engine
2017-07-11 16:50:52 -04:00
57481ff30b Re-vendor swarmkit. This includes the following fixes:
- https://github.com/docker/swarmkit/pull/2266 (support for templating Node.Hostname in docker executor)
- https://github.com/docker/swarmkit/pull/2281 (change restore action on objects to be update, not delete/create)
- https://github.com/docker/swarmkit/pull/2285 (extend watch queue with timeout and size limit)
- https://github.com/docker/swarmkit/pull/2253 (version-aware failure tracking in the scheduler)
- https://github.com/docker/swarmkit/pull/2275 (update containerd and port executor to container client library)
- https://github.com/docker/swarmkit/pull/2292 (rename some generic resources)
- https://github.com/docker/swarmkit/pull/2300 (limit the size of the external CA response)
- https://github.com/docker/swarmkit/pull/2301 (delete global tasks when the node running them is deleted)

Minor cleanups, dependency bumps, and vendoring:
- https://github.com/docker/swarmkit/pull/2271
- https://github.com/docker/swarmkit/pull/2279
- https://github.com/docker/swarmkit/pull/2283
- https://github.com/docker/swarmkit/pull/2282
- https://github.com/docker/swarmkit/pull/2274
- https://github.com/docker/swarmkit/pull/2296 (dependency bump of etcd, go-winio)

Signed-off-by: Ying Li <ying.li@docker.com>
Upstream-commit: 4509a001dffff626d2d8708fd2eb1c6317b201f3
Component: engine
2017-07-11 13:43:43 -07:00
b37b45da61 Remove unnecessary use of SetConfigfile
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3da0cbfdd1
Component: cli
2017-07-11 14:49:30 -04:00
1e5fbb03aa Update FakeCli to remove duplication in tests.
Use byte buffers by default, since that is what is done most of the time.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 69b142b52a
Component: cli
2017-07-11 14:49:30 -04:00
152c598ec8 Pin all tools used in the Dockerfiles
Also update gometalinter to use the official version. The update
found some new gosimple errors, which are fixed.

Also update the filewatcher script for the latest version of filewatcher.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 102a8f0c9d
Component: cli
2017-07-11 14:23:27 -04:00
07b047e230 login: add a --password-stdin argument
This:

* conflicts with --password (naturally)
* conflicts with the absence of --username (both can't be grabbed by the
  stdin)
* strips a trailing newline off the password if it exists

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
Upstream-commit: 7d18477bc2
Component: cli
2017-07-11 12:16:29 -06:00
dcefa0bb91 Don't attempt to remove unsupported resources on older daemon
When running `docker stack rm <some stack>` against an older daemon,
a warning was printed for "configs" being ignored;

    WARNING: ignoring "configs" (requires API version 1.30, but the Docker daemon API version is 1.26)

Given that an old daemon cannot _have_ configs, there should not be
a need to warn, or _attempt_ to remove these resources.

This patch removes the warning, and skips fetching (and removing)
configs.

A check if _secrets_ are supported by the daemon is also added,
given that this would result in an error when attempted against
an older (pre 1.13) daemon.

There is one situation where this could lead to secrets or
configs being left behind; if the client is connecting to a
daemon that _does_ support secrets, configs, but the API version
is overridden using `DOCKER_API_VERSION`, no warning is printed,
and secrets and configs are not attempted to be removed.

Given that `DOCKER_API_VERSION` is regarded a feature for
debugging / "power users", it should be ok to ignore this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 2429f15672
Component: cli
2017-07-11 10:29:03 -07:00
e95f4619cd [project] change syscall to /x/sys/unix|windows
Changes most references of syscall to golang.org/x/sys/
Ones aren't changes include, Errno, Signal and SysProcAttr
as they haven't been implemented in /x/sys/.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

[s390x] switch utsname from unsigned to signed

per 33267e036f
char in s390x in the /x/sys/unix package is now signed, so
change the buildtags

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: 069fdc8a083cb1663e4f86fe3fd9b9a1aebc3e54
Component: engine
2017-07-11 08:00:32 -04:00
4df758062c Merge pull request #312 from thaJeztah/remove-unused-prune-functions
Remove unused prune functions
Upstream-commit: 6908e58f0f
Component: cli
2017-07-11 12:15:44 +02:00
d29a2e376a Merge pull request #318 from thaJeztah/pin-vndr
pin vndr to 9909bb2b8a0b7ea464527b376dc50389c90df587
Upstream-commit: b7b680590b
Component: cli
2017-07-11 12:14:59 +02:00
2fe1273c48 Merge pull request #321 from albers/remove-completion-service-update--network
Remove bash completion for `service update --network`
Upstream-commit: 251eafd637
Component: cli
2017-07-11 12:14:27 +02:00
94a5aefc94 make engine support cluster config event
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: ed916a233c577693afc8dc3122311c15246d00cc
Component: engine
2017-07-11 17:21:15 +08:00
97978c93db Remove bash completion for service update --network
The `--network` option is only available for `docker service create`.

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: e7e77b5e65
Component: cli
2017-07-11 11:20:18 +02:00
fef91e1185 Merge pull request #34035 from allencloud/add-cluster-event-details-in-swagger
add cluster events details in swagger.yml
Upstream-commit: 6978a6e25a2e6063f280ec842bd0f3eae99426e1
Component: engine
2017-07-11 11:04:27 +02:00
778f3ff836 Merge pull request #34047 from thaJeztah/revendor-dependencies
Bump vndr to 9909bb2b8a0b7ea464527b376dc50389c90df587
Upstream-commit: 177d281b5c165aa99916f7d516550f50fc75b05c
Component: engine
2017-07-11 11:04:05 +02:00
1d9d7c17b0 Merge pull request #33816 from albers/enable-completion
Enable bash completion in development container
Upstream-commit: 031fd77702305fec52b9c5892985fc032257374b
Component: engine
2017-07-10 21:39:43 -07:00
9981e245e4 Merge pull request #34050 from thaJeztah/fix-api-version-docs
Fix api-version history
Upstream-commit: 5892a41c583823e7b7048e1dc647641d7e2ff3d8
Component: engine
2017-07-10 21:21:57 -07:00
6d8f8266f4 Fix api-version history
Commit c79c16910c0f3d6e88f2dc6ef609ecc3b02ccef9
inadvertently put these API changes under API 1.31,
but they were added in API 1.30.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: dd5e818fabc7edf7fa4d952e62b949b224909d2a
Component: engine
2017-07-10 21:15:02 -07:00
cfd6048882 add cluster events details in swagger.yml
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: f596fb7683227021b74d299ad1613a1e3263cf30
Component: engine
2017-07-11 11:54:22 +08:00
3ac74eb8fd Merge pull request #33979 from allencloud/return-prune-data-when-context-canceled
return prune data when context canceled
Upstream-commit: 73e8f56d6aed223c0f9997e8bd225e446664e647
Component: engine
2017-07-10 21:17:18 -04:00
e54b9b8905 pin vndr to 9909bb2b8a0b7ea464527b376dc50389c90df587
This make updating vndr a deliberate action, and
prevents updates to vndr from making the vendor
validation fail in CI.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 008785f5b5
Component: cli
2017-07-10 14:31:57 -07:00
4a3ac40163 Merge pull request #33956 from keloyang/fix-cp-with-hardlink
Fix docker cp dir with hard link
Upstream-commit: 9789530b46f36e2961113949f117f93c1fd4e60c
Component: engine
2017-07-10 14:11:26 -07:00
30a181615a Bump vndr to 9909bb2b8a0b7ea464527b376dc50389c90df587
This bumps vndr to 9909bb2b8a0b7ea464527b376dc50389c90df587
and revendors dependencies.

Includes a change that prunes go files with `+build ignore`

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 63f4bc5237dc928125ac62aa5468f6d8b28272c7
Component: engine
2017-07-10 14:05:13 -07:00
740312d66e Remove unused prune functions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: d8a2972cb1
Component: cli
2017-07-10 13:27:19 -07:00
48a86be4fc Merge pull request #316 from thaJeztah/revendor-dependencies
Revendor dependencies
Upstream-commit: a765218f19
Component: cli
2017-07-10 13:23:17 -07:00
f217147904 Revendor dependencies
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 3e3c9d69d8
Component: cli
2017-07-10 10:56:42 -07:00
5ed9aa29f5 Merge pull request #34040 from justincormack/windows-homedir
Split homedir files by operating system
Upstream-commit: e639a70fbe999d96354a5bcf560231b7b8aa935c
Component: engine
2017-07-11 01:27:50 +09:00
db491388be Merge pull request #33996 from thaJeztah/un-fork-etcd
Un-fork coreos/etcd - bump to v3.2.1
Upstream-commit: 0ea804c2405f42ecd8e1834d329fa45f326bf175
Component: engine
2017-07-10 09:14:22 -07:00
b53529452f Merge pull request #33377 from yastij/33371-matchevent-filtering
matching events using ID and name
Upstream-commit: e56e78976eefdd17d333c3aa63382b2e4bfd889d
Component: engine
2017-07-10 16:11:14 +02:00
b8ebf7be04 Split homedir files by operating system
libcontainer/user does not build at all on Windows any more, and
this was breaking the client on Windows with upstream `runc`. As
these functions are not used anyway, just split out and stop
checking `runtime`.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
Upstream-commit: b7bd959294b5dc5b6e18b3fed5dde18f4f7f1d20
Component: engine
2017-07-10 14:10:43 +01:00
9e646d8386 Return an empty stats if "container not found"
If we get "container not found" error from containerd, it's possibly
because that this container has already been stopped. It will be ok to
ignore this error and just return an empty stats.

Signed-off-by: Yuanhong Peng <pengyuanhong@huawei.com>
Upstream-commit: 4a6cbf9bcb78d38c48ef963f585f0fadf733e101
Component: engine
2017-07-10 16:30:48 +08:00
e7c8bab937 Merge pull request #298 from dnephin/fix-stack-out-stream
Fix stack output stream
Upstream-commit: af6c0896f5
Component: cli
2017-07-10 09:23:23 +02:00
f4101eb2fb return prune data when context canceled
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 87b4dc2002d50e245f432bbd97e9dee2db25cf96
Component: engine
2017-07-10 10:06:24 +08:00
87ec40c8a8 Merge pull request #33999 from Microsoft/jjh/opengcs0.0.9
Revendor jhowardmsft/opengcs v0.0.9
Upstream-commit: 20eb2caa3bad9a0937d80a56bd4a3060d9f8c573
Component: engine
2017-07-09 17:46:43 -07:00
5c3ab94b35 Merge pull request #33988 from Deborah-Digges/patch-1
Add link to docker.com in README.md
Upstream-commit: 15a22a6641f4e418d37fe5c75380dc57c56db3f1
Component: engine
2017-07-09 16:40:38 -07:00
3578bb4ff2 Merge pull request #259 from aaronlehmann/service-progress-surface-error
progress: Show task error in place of progress bar
Upstream-commit: 7ae9bc141c
Component: cli
2017-07-09 00:04:38 -07:00
b41167fb89 Merge pull request #270 from tych0/warn-only-about-password-on-cli
login: print a big warning when using --password
Upstream-commit: c99530b1d2
Component: cli
2017-07-08 16:37:40 -07:00
dddc944164 Merge pull request #33990 from thaJeztah/remove-install-script
Remove old "get.docker.com" install script
Upstream-commit: b227c568dd749512ff43e1d7aecf7580f305cba7
Component: engine
2017-07-07 21:50:37 -07:00
dd3dcdbd0d vendor: add go-semver
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 733f672100a436b272ea871c4ba427f07d7bfa8a
Component: engine
2017-07-07 16:42:14 -07:00
4cb9d45e3f Merge pull request #33541 from aaronlehmann/lock-unlock-tests-poll
integration-cli: Replace sleeps with polling in swarm lock/unlock tests
Upstream-commit: ced0b6cb5bd3acd223dc20a13ba5be1dbf0ff643
Component: engine
2017-07-07 16:41:01 -07:00
23b4fdf3bc removing TODO, and explain why we can't filter by id on the matchevent method.
Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>
Upstream-commit: be9aa09246534a1fdf7c08cf287dbe1e6de375c9
Component: engine
2017-07-07 23:32:37 +02:00
89b86f4aaf Merge pull request #308 from ProgVal/patch-1
Fix typo (proceed -> precede)
Upstream-commit: 534c3d285b
Component: cli
2017-07-07 13:45:00 -07:00
aa221f747d Fix typo (proceed -> precede)
Signed-off-by: Valentin Lorentz <progval+git@progval.net>
Upstream-commit: 4f3a8aecad
Component: cli
2017-07-07 13:17:15 +02:00
0887a18a3a Merge pull request #33575 from cpuguy83/plugins_on_swarm
Plugins on swarm
Upstream-commit: 05c7c311390911daebcf5d9519dee813fc02a887
Component: engine
2017-07-07 02:23:07 -07:00
0371882bb8 Merge pull request #33662 from madhanrm/sharedendpoint
Include Endpoint List for Shared Endpoints
Upstream-commit: 9aecbbf9bf50dd5c3d250e8dc1c74360a9f30d8e
Component: engine
2017-07-06 23:44:23 -07:00
cb27d2c59c Merge pull request #33940 from yaocaigen/fix_container_multi_names
Fix run `docker rename <container-id> new_name` concurrently, the container will have multi names
Upstream-commit: 8e3555f8539d91f530f895e19a51db14f1ca93fb
Component: engine
2017-07-07 10:58:01 +09:00
abfe031053 Merge pull request #33713 from x1022as/error_fd
fd leak and error handling
Upstream-commit: 3be2273d03e4b06dff4006b1a600c578c7aa09fc
Component: engine
2017-07-06 16:47:34 -07:00
4b7c8d1706 Merge pull request #303 from yastij/fix-SIGSEGV-runContainer
fixing SIGSEGV when running containers
Upstream-commit: dfdbdab651
Component: cli
2017-07-06 15:45:38 -07:00
eb145cf9d7 Revendor jhowardmsft/opengcs v0.0.9
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 7643e8909675fb7b1d52a8c7566fb674db340a39
Component: engine
2017-07-06 14:29:43 -07:00
9b7ee7b6ee Merge pull request #33935 from AkihiroSuda/pkg-archive-go1.9
pkg/archive.FileInfoHeader: fill file type bits
Upstream-commit: 0fcd082d886323b4506b28394ee28eaa5a5dfe7f
Component: engine
2017-07-06 14:22:45 -07:00
f6e262f402 Un-fork coreos/etcd - bump to v3.2.1
Commit 077f08bf54dc89d382cbcbd797b2bd7c4867151d
temporarily switch etcd to a fork, pending a
pull-request to be merged, and a new release
that contains the change.

The pull request was merged, and included in
etcd v3.2.0

This patch bumps etcd to v3.2.1, which contains
some bug-fixes on top of v3.2.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: cbc480a40cb22653ac647a8d24957a0c33e3bffe
Component: engine
2017-07-06 13:58:13 -07:00
455cc50b83 Include Endpoint List for Shared Endpoints
Do not allow sharing of container network with hyperv containers

Signed-off-by: Madhan Raj Mookkandy <madhanm@microsoft.com>
Upstream-commit: 349913ce9fde34d8acd08fad5ce866401f4d135e
Component: engine
2017-07-06 12:19:17 -07:00
754d5e0397 Remove old "get.docker.com" install script
This script is part of the Docker product,
and no longer maintained in this repository.

The script has been updated to install Docker CE
packages from https://download.docker.com, and is
now located in the https://github.com/docker/docker-install
repository.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: e038f9f81f871237e9ec7a2188eb6b401bdd8809
Component: engine
2017-07-06 11:29:07 -07:00
c782cb6c44 Make plugin emit strongly typed, consumable events
Enables other subsystems to watch actions for a plugin(s).

This will be used specifically for implementing plugins on swarm where a
swarm controller needs to watch the state of a plugin.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 72c3bcf2a533a827402945e3a55872e2db4fb024
Component: engine
2017-07-06 14:26:06 -04:00
f002184455 progress: Light refactor
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: c9b92a328d
Component: cli
2017-07-06 10:40:35 -07:00
4ad1d46962 Add link to docker.com in README.md
- Update README with the link to docker.com

Signed off by Author:    Deborah Gertrude Digges <deborah.gertrude.digges@gmail.com>

Signed-off-by: ddigges <deborahgertrude_digges@intuit.com>
Upstream-commit: f63ec3d87467419a94f827939a1eaefa03b2f181
Component: engine
2017-07-06 23:09:54 +05:30
b0f07c55f2 fixing SIGSEGV when running containers
Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>

moving the deffering of the close after the error checking

Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>

fixing SIGSEGV when running containers

Signed-off-by: Yassine TIJANI <yasstij11@gmail.com>
Upstream-commit: 45b0e7cf1a
Component: cli
2017-07-06 18:57:36 +02:00
7668114cba Fix docker cp dir with hard link
docker run --name=test ubuntu /bin/sh -c "cd /tmp && echo hi > a && ln a b" && docker cp test:/tmp tmp_
test
link /root/tmp/a /root/tmp_/b: no such file or directory

Signed-off-by: yangshukui <yangshukui@huawei.com>
Upstream-commit: d58ffa0364c04d03a8f25704d7f0489ee6cd9634
Component: engine
2017-07-06 17:03:38 +08:00
e249ded12b Merge pull request #211 from ksouf/issue-37-add-tests-on-commands
adding network_create tests 
Upstream-commit: 1aa82bc7df
Component: cli
2017-07-06 08:59:15 +02:00
e839364f20 Merge pull request #296 from thaJeztah/fix-error-overwrite
Fix error variable being overwritten
Upstream-commit: e672589ec0
Component: cli
2017-07-05 19:26:27 -07:00
9691a9deb1 Merge pull request #33941 from thaJeztah/update-api-docs
Add missing API documentatoin for DataPathAddr
Upstream-commit: 9d95740dbfb790b3ea531a363697076ffb97a294
Component: engine
2017-07-05 18:35:45 -07:00
c36d6e2e41 Merge pull request #33859 from tonistiigi/session-includepaths
Add path filtering to build session client
Upstream-commit: 19ee87361685ae63aa2eca4a2ae5a2035484814b
Component: engine
2017-07-05 18:21:48 -07:00
74d8ac0d96 Merge pull request #33897 from cpuguy83/jsonfile_log_blocking
Fix log readers can block writes indefinitely
Upstream-commit: db8c2651b84c681579389bb57d309a3b210a7e78
Component: engine
2017-07-05 18:21:14 -07:00
096ae0539f Merge pull request #33898 from crosbymichael/swappiness
Do not set -1 for swappiness
Upstream-commit: 490b55e8fa73be4c78de0118fe63a7ce5dc0f383
Component: engine
2017-07-05 17:04:08 -07:00
b9da7abd2e Merge pull request #19 from seemethere/increment_to_ga
Increment RPM changelog to docker-ce 17.06.0-ce
Upstream-commit: d6cdd2cd4edc041e0887b741ae11ae9e925eb055
Component: packaging
2017-07-05 15:59:25 -07:00
8172ee629e Merge pull request #26 from seemethere/add_operating_instructions
Adds operating instructions
Upstream-commit: b970db134960bcb7c18ce7f41667554a4efc8761
Component: packaging
2017-07-05 15:59:06 -07:00
259b5f4251 adding unit tests to network
Signed-off-by: khaled souf <khaled.souf@gmail.com>
Upstream-commit: 57c1551991
Component: cli
2017-07-06 00:54:30 +02:00
a9905bfdd7 Fix error variable being overwritten
The `err` variable was set in a loop, so only
the last result was taken into account to return
"failure" or not.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 4d4c789cac
Component: cli
2017-07-05 13:54:57 -07:00
5f5ef4ba5a Add parallelism to cross build
Reusable docker engine

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 1eb66d60bd
Component: cli
2017-07-05 15:23:32 -04:00
2aedd8b160 Fix log readers can block writes indefinitely
Before this patch, a log reader is able to block all log writes
indefinitely (and other operations) by simply opening the log stream and
not consuming all the messages.

The reason for this is we protect the read stream from corruption by
ensuring there are no new writes while the log stream is consumed (and
caught up with the live entries).

We can get around this issue because log files are append only, so we
can limit reads to only the section of the file that was written to when
the log stream was first requested.

Now logs are only blocked until all files are opened, rather than
streamed to the client.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: e2209185ed1c959131d4068ec7fc93e194dc0802
Component: engine
2017-07-05 14:04:52 -04:00
2af533daad Remove duplication in task formatting.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0030bfea9f
Component: cli
2017-07-05 13:40:47 -04:00
6d92cf3a08 Fix stream for 'nothing found in stack' message
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: fb6deb1077
Component: cli
2017-07-05 13:32:54 -04:00
73e9cd2c31 Merge pull request #286 from thaJeztah/bump-moby
Bump moby to 87df0e533b619c088091fd1e2310e92bb9a24822
Upstream-commit: 30933b516b
Component: cli
2017-07-05 09:38:32 -04:00
14554f495c Fix run docker rename <container-id> new_name concurrently, the container will have multi names
When run `docker rename <container-id> new_name` concurrently, every operation will release
container's old name. So container will have multi new names reserve in nameIndex.

Signed-off-by: Yang Pengfei <yangpengfei4@huawei.com>
Upstream-commit: cc2340689c431504689d01c9516b3a340b2e8dbc
Component: engine
2017-07-05 16:56:31 +08:00
64645433a6 pkg/archive.FileInfoHeader: fill file type bits
Go 1.9 (golang/go@66b5a2f) removed file type bits from
archive/tar.FileInfoHeader().

This commit ensures file type bits are filled even on Go 1.9 for
compatibility.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 1a451d9a7bb9cd7d437b42d4e73b0560fbf84348
Component: engine
2017-07-05 05:24:32 +00:00
9c9fdfadf7 update tests for new image struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: e8080dd7e5
Component: cli
2017-07-04 20:34:24 -07:00
542cf421f5 Bump moby to 87df0e533b619c088091fd1e2310e92bb9a24822
Includes changes from;

- Add a LastTagTime for images (https://github.com/moby/moby/pull/31497)
- Fix handling of remote "git@" notation (https://github.com/moby/moby/pull/33696)
- Move some `api` package functions away (https://github.com/moby/moby/pull/33798) (related to https://github.com/docker/cli/pull/236)
- Set ping version even on error (https://github.com/moby/moby/pull/33827)
- Do not add duplicate platform information to service spec (https://github.com/moby/moby/pull/33867)
- Refactor MountPoint Setup function in volume.go (https://github.com/moby/moby/pull/33890)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 366d3ec971
Component: cli
2017-07-04 20:23:38 -07:00
36ea5491ac Merge pull request #287 from thaJeztah/use-v1.0.0-tag-for-go-difflib
Use v1.0.0 tag for go-difflib
Upstream-commit: dc9feff879
Component: cli
2017-07-04 17:32:00 +02:00
2a3613893d Merge pull request #276 from adshmh/add-unit-tests-to-checkpoint-package
add unit tests to checkpoint package
Upstream-commit: 3554d02f33
Component: cli
2017-07-04 11:17:25 -04:00
9fdb37ee64 Merge pull request #288 from thaJeztah/bump-go-winio
Bump go-winio to 0.4.2
Upstream-commit: e08cb59c8a
Component: cli
2017-07-04 16:59:32 +02:00
5305c7b28b Merge pull request #248 from albers/completion-network-create--scope
Add bash completion for `network create --scope|--config-only|config-from`
Upstream-commit: 306212574a
Component: cli
2017-07-04 16:48:18 +02:00
58665dca40 Merge pull request #246 from albers/completion-prune--filter-label
Add bash completion for `label` filter of `prune` commands
Upstream-commit: 1f45f1b5f9
Component: cli
2017-07-04 16:44:23 +02:00
4f68746145 Merge pull request #282 from albers/completion-daemon-updates
Updates to bash completion for `dockerd`
Upstream-commit: 42a31ff8c1
Component: cli
2017-07-04 16:42:10 +02:00
e562168436 Merge pull request #285 from albers/completion-overlay2.size
Add bash completion for `dockerd --storage-opt overlay2.size`
Upstream-commit: d47bbb8358
Component: cli
2017-07-04 16:41:35 +02:00
d2b6d249be Merge pull request #243 from vieux/scale2
add `--detach` to docker scale 
Upstream-commit: 43fb4a4547
Component: cli
2017-07-04 16:36:59 +02:00
08a00684a2 Merge pull request #33944 from cpuguy83/fix_wrong_dirname
Fix plugin remove dir name after rename.
Upstream-commit: 82c2a08b6018586f3c8f35405c3bd6fce3c78ccd
Component: engine
2017-07-04 16:12:39 +02:00
ec1ee882b3 Merge pull request #33322 from jsoref/spelling
Spelling
Upstream-commit: ff4f700f74450018f36d014f3cde0ff1b9c17fb3
Component: engine
2017-07-04 15:46:34 +02:00
460a63fa01 Add bash completion for dockerd --metrics-addr
`--metrics-addr` does not accept network interface names.
Therefore `__docker_local_interfaces` was refined for this feature to
optionally exclude interface names.

Note that although `--metrics-addr` is experimental, it cannot be
selectively enabled in bash completion because the test for the daemon
running in experimental mode requires a running daemon. As this
completion pertains to starting the daemon, this requirement is not met.

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 0ea31afd57
Component: cli
2017-07-04 14:40:22 +02:00
b4c3d928eb Fix plugin remove dir name after rename.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 4bf263c19873718394f8161dbc020bf4be30f9d6
Component: engine
2017-07-04 07:37:26 -04:00
f186d3c42f Merge pull request #289 from mstanleyjones/multiple-env
Provide examples for multiple uses of the same flag
Upstream-commit: 357ff50fa9
Component: cli
2017-07-04 12:48:20 +02:00
e720e150d4 Add missing API documentatoin for DataPathAddr
COmmit 0307fe1a0bcdc02583a24add41eb783c117bad8c added
a new `DataPathAddr` property to the swarm/init and swarm/join
endpoints. This property was not yet added to the
documentation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: c79c16910c0f3d6e88f2dc6ef609ecc3b02ccef9
Component: engine
2017-07-04 03:11:40 -07:00
72c6de1018 Merge pull request #292 from thaJeztah/clarify-docker-go-package
Clarify docker/go package
Upstream-commit: 8df4cd1edc
Component: cli
2017-07-03 23:44:26 -07:00
e194cd1eb4 Merge pull request #290 from mstanleyjones/d-and-rm-flags
Clarify that you can use -d and --rm together now
Upstream-commit: 98b7dbe908
Component: cli
2017-07-03 23:43:36 -07:00
c966fe9e08 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-07-04 05:59:51 +00:00
4ca82b695b Merge pull request #28 from thaJeztah/fix-contrib-paths
Fix paths for completion scripts
Upstream-commit: 7416a7521a6ad21c7925237230d26855c76b222f
Component: packaging
2017-07-03 22:57:12 -07:00
f2ec8286bb Merge pull request #33494 from cpuguy83/document_stream_format_in_client_lib
Add stream format details for attach/logs endpoint
Upstream-commit: a9358df62cde2deb8184c742e6fb8d16c98a04a9
Component: engine
2017-07-03 22:02:24 -07:00
bfb65fa0bb Merge pull request #33830 from cpuguy83/33799_fix_plugin_mounts_issue
Make plugin removes more resilient to failure
Upstream-commit: 48adb9d9549b8e5c4e9fd34335161c7676395e5a
Component: engine
2017-07-03 18:37:31 -07:00
e415e09501 Clarify docker/go package
This package is used by Notary. Add a comment to
the vendor.conf file to explain what it contains
and what it's used for.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 60fe70c900
Component: cli
2017-07-03 18:00:46 -07:00
9e2f4854f6 Clarify that you can use -d and --rm together now
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Upstream-commit: c63485b47d
Component: cli
2017-07-03 16:43:41 -07:00
017354f791 Provide examples for multiple uses of the same flag
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Upstream-commit: ef61582591
Component: cli
2017-07-03 16:21:28 -07:00
ca1a24c1df Bump go-winio to 0.4.2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 8a3c89b409
Component: cli
2017-07-03 14:37:56 -07:00
3fea46b7b2 Merge pull request #33884 from aaronlehmann/redact-secret-payload
middleware: Redact secret data on "secret create"
Upstream-commit: b9f248d0ea9f7ec4e0325c7034038319c70c2dda
Component: engine
2017-07-03 14:18:32 -07:00
63c7ce310a Merge pull request #33213 from gkze/master
GCP Logs: send log text as jsonPayload.message instead of jsonPayload.data
Upstream-commit: c2ad549533cf2ffdb8b93ce8eb0bad5c695b828c
Component: engine
2017-07-03 16:18:18 -04:00
643654c2f0 Spelling fixes
* additional
* ambiguous
* anonymous
* anything
* application
* because
* before
* building
* capabilities
* circumstances
* commit
* committer
* compresses
* concatenated
* config
* container
* container's
* current
* definition
* delimiter
* disassociates
* discovery
* distributed
* doesnotexist
* downloads
* duplicates
* either
* enhancing
* enumerate
* escapable
* exactly
* expect
* expectations
* expected
* explicitly
* false
* filesystem
* following
* forbidden
* git with
* healthcheck
* ignore
* independent
* inheritance
* investigating
* irrelevant
* it
* logging
* looking
* membership
* mimic
* minimum
* modify
* mountpoint
* multiline
* notifier
* outputting
* outside
* overridden
* override
* parsable
* plugins
* precedence
* propagation
* provided
* provides
* registries
* repositories
* returning
* settings
* should
* signals
* someone
* something
* specifically
* successfully
* synchronize
* they've
* thinking
* uninitialized
* unintentionally
* unmarshaling
* unnamed
* unreferenced
* verify

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 39bcaee47b8a284a46b761afe218ba7deda0d482
Component: engine
2017-07-03 13:13:09 -07:00
2040dca50c Merge pull request #33405 from jsoref/gofmt
gofmt: 5 files
Upstream-commit: acd20d8a8ea6fe7d00e10d4946cc68c7162355bc
Component: engine
2017-07-03 13:06:10 -07:00
d174953fec Merge pull request #33843 from moypray/exit
Set unpaused state when receiving 'stateExit' event
Upstream-commit: f8f1a3ade97bf5c9fd96836e9a436b19ef5ac660
Component: engine
2017-07-03 16:02:18 -04:00
ef3fca8458 Merge component 'engine' from git@github.com:moby/moby master 2017-07-03 19:12:09 +00:00
d49a090a5e Merge component 'cli' from git@github.com:docker/cli master 2017-07-03 18:51:34 +00:00
d7aea54f11 Use v1.0.0 tag for go-difflib
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 42d83d20c9
Component: cli
2017-07-03 11:42:28 -07:00
654d76c922 Do not set -1 for swappiness
Do not set a default value for swappiness as the default value should be
`nil`

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 9d87e6e0fb799d6ef3bb9a97bc523f8d343b5fb3
Component: engine
2017-07-03 11:23:15 -07:00
c2eb21415c gofmt: 5 files
gofmt from go1.8.3

hg locate '*.go' |xargs ~/go/bin/gofmt -s -w

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 6284cf5e9a4bc121b73422c454cdbf8dc18f42f3
Component: engine
2017-07-03 10:32:47 -07:00
666b2cc734 devicemapper: add --storage-opt dm.libdm_log_level=X option
Because we use our own logging callbacks in order to use libdm
effectively, it is quite difficult to debug complicated devicemapper
issues (because any warnings or notices from libdm are muted by our own
callback function). e07d3cd9a ("devmapper: Fix libdm logging") further
reduced the ability of this debugging by only allowing _LOG_FATAL errors
to be passed to the output.

Unfortunately libdm is very chatty, so in order to avoid making the logs
even more crowded, add a dm.libdm_log_level storage option that allows
people who are debugging the lovely world of libdm to be able to dive in
without recompiling binaries.

The valid values of dm.libdm_log_level map directly to the libdm logging
levels, and are in the range [2,7] as of the time of writing with 7
being _LOG_DEBUG and 2 being _LOG_FATAL. The default is _LOG_FATAL.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
Upstream-commit: 198f83bba120c6c9bda679d33a55acab6cc9f33d
Component: engine
2017-07-04 02:04:26 +10:00
00264ebf6b devicemapper: change LogInit and move all callbacks to pkg
LogInit used to act as a manual way of registering the *necessary*
pkg/devicemapper logging callbacks. In addition, it was used to split up
the logic of pkg/devicemapper into daemon/graphdriver/devmapper (such
that some things were logged from libdm).

The manual aspect of this API was completely non-sensical and was just
begging for incorrect usage of pkg/devicemapper, so remove that semantic
and always register our own libdm callbacks.

In addition, recombine the split out logging callbacks into
pkg/devicemapper so that the default logger is local to the library and
also shown to be the recommended logger. This makes the code
substantially easier to read. Also the new DefaultLogger now has
configurable upper-bound for the log level, which allows for dynamically
changing the logging level.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
Upstream-commit: cfd39e8d6d79eee8a71fbe6820dd67babf05d951
Component: engine
2017-07-04 02:04:26 +10:00
01199b4ca4 devicemapper: actually remove DmLogInitVerbose
e07d3cd9a ("devmapper: Fix libdm logging") removed all of the callers of
DmLogInitVerbose, but we still kept around the wrapper. However, the
libdm dm_log_init_verbose API changes the verbosity of the *default*
libdm logger. Because pkg/devicemapper internally *relies* on using
logging callbacks to understand what errors were encountered by libdm,
this wrapper is useless (it only makes sense for the default logger
which we do not user).

Any user not inside Docker of this function almost certainly was not
using this API correctly, because pkg/devicemapper will misbehave if our
logging callbacks were not registered.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
Upstream-commit: c654147f0635736fff0035ecdfa53a41c7fad0d0
Component: engine
2017-07-04 02:04:26 +10:00
9421df98fb devicemapper: remove 256 character limit of libdm logs
This limit is unecessary and can lead to the truncation of long libdm
logs (which is quite annoying).

Fixes: b440ec013 ("device-mapper: Move all devicemapper spew to log through utils.Debugf().")
Signed-off-by: Aleksa Sarai <asarai@suse.de>
Upstream-commit: 63328c6882c3d1f54c66499ef9963adfbf1883f0
Component: engine
2017-07-04 02:04:26 +10:00
dff3d848de Add bash completion for dockerd --storage-opt overlay2.size
This adds bash completion for
- https://github.com/docker/cli/pull/215
- https://github.com/moby/moby/pull/32977

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: a4b1769bb6
Component: cli
2017-07-03 18:03:00 +02:00
a2a898edc8 Merge pull request #33899 from cyphar/make-dynbinary
make: add dynbinary target
Upstream-commit: 8bc681262f970b243cb5e9796c47ecd8d6b6aabf
Component: engine
2017-07-03 17:50:20 +02:00
b0ff0a2e4a Merge pull request #33888 from thaJeztah/enable-version-negotiation
Always perform version-negotiation
Upstream-commit: 75a034621d715bf01069cc3f7bab0cce85fa744c
Component: engine
2017-07-03 17:46:35 +02:00
955a71e569 Merge pull request #33926 from coolljt0725/fix_wrong_file_mode
Fix wrong filemode for rotate log files
Upstream-commit: d061ad4a1b3b029e4afa042c1eaf707037562e8c
Component: engine
2017-07-03 17:45:14 +02:00
bd2899d4b2 Merge pull request #33908 from thaJeztah/carry-33883-ignore-nonexistent-containers
[carry 33883] daemon: Ignore nonexistent containers when listing containers
Upstream-commit: cab50de4d682890187b48984e0c81b98cb69ed4f
Component: engine
2017-07-03 17:06:54 +02:00
c914e1a6cd Merge pull request #213 from dnephin/improve-swarm-ca-cmd
Refactor and UI changes to `swarm ca` command
Upstream-commit: 85b41c3e71
Component: cli
2017-07-03 17:02:45 +02:00
f4b9a413f3 login: print a big warning when using --password
Task command lines are world readable via /proc/pid/cmdline, so this isn't
safe.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
Upstream-commit: c269ad26e8
Component: cli
2017-07-03 08:47:20 -06:00
3abe1e3a95 Add bash completion for dockerd --cpu-rt-(period|runtime)
This adds bash completion for https://github.com/moby/moby/pull/23430.

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 74a5d1af86
Component: cli
2017-07-03 13:55:46 +02:00
67ccad49a6 Add bash completion for dockerd --default-runtime
`--default-runtime` was added in https://github.com/moby/moby/pull/22983

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: d610951e85
Component: cli
2017-07-03 13:44:23 +02:00
0b37ceed6f scale all services at once
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 58d3fc24b1
Component: cli
2017-07-03 13:40:54 +02:00
523bbfaf9d Add bash completion for dockerd --no-new-privileges
This adds bash completion for https://github.com/moby/moby/pull/32944.

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 112348d4db
Component: cli
2017-07-03 13:33:01 +02:00
bea84311a0 Add bash completion for dockerd --version
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 5296907bef
Component: cli
2017-07-03 13:32:29 +02:00
167d48d341 Add bash completion for dockerd --swarm-default-advertise-addr
This adds bash completion for https://github.com/moby/moby/pull/24237.

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: cf3ffc516b
Component: cli
2017-07-03 13:09:43 +02:00
f8f582f303 Set unpasued state when receiving 'stateExit' event
Description:
 1. start a container with restart=always.
    `docker run -d --restart=always ubuntu sleep 3`
 2. container init process exits.
 3. use `docker pause <id>` to pause this container.

if the pause action is before cgroup data is removed and after the init process died.
`Pause` operation will success to write cgroup data, but actually do not freeze any process.

And then docker received pause event and stateExit event from
containerd, the docker state will be Running(paused), but the container
is free running.

Then we can not remove it, stop it , pause it  and unpause it.

Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
Upstream-commit: fe1b4cfba6320793373c5397641d743d9fe94cf8
Component: engine
2017-07-03 17:26:13 +08:00
0257839dba Merge pull request #33853 from vieux/report-2017-06-26
Moby Dev Report 2017 06 26
Upstream-commit: 714c226b431c73efa43373fb7a284408b709c80f
Component: engine
2017-07-03 11:18:11 +02:00
3a59ac4d9f Fix wrong filemode for rotate log files
the filemode should be 0640 but not 06400

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 96ea8eaa1592856e0829c3465e64f93911d3e389
Component: engine
2017-07-03 03:49:22 -04:00
155031dfee Merge pull request #33920 from thaJeztah/remove-fork-message
Remove comment about forked golang.org/x/net
Upstream-commit: 7117d5ef25b54c3384fbaf5cf279e0dcc6701a52
Component: engine
2017-07-02 00:29:30 -07:00
9787d41c94 Remove comment about forked golang.org/x/net
This dependency was temporarily forked, but
the fork was removed in db37a86d37431a1d82505cf6adc91a5d91dad146.

This patch removes the comment

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: fe877c2b959b60d953ad4b2d3eeda377add575a5
Component: engine
2017-07-02 00:19:15 -07:00
c5ade3e304 daemon: Ignore nonexistent containers when listing containers
The name/ID relationships are maintained separately from the memdb and
can be out of sync from any particular memdb snapshot. If a container
does not exist in the memdb, we must accept this as normal and not fail
the listing. This is consistent with what the code used to do before
memdb was introduced.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: d257a63fb6a2ad0c2369981914544add389917bf
Component: engine
2017-06-30 15:19:47 -07:00
b58012d75f add unit tests to cli/command/checkpoint package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: b296abd542
Component: cli
2017-06-30 17:17:47 -04:00
27d204d888 make: add dynbinary target
Recently, it's become necessary to build dynbinaries on certain
distributions, so make it easier for users to build dynbinaries. It
looks like this was just an oversight when we added dynbinary builds.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
Upstream-commit: c81255c9c0314b81ab27f6afd7646cdd259e6495
Component: engine
2017-07-01 04:54:57 +10:00
8e86b3a04f Merge pull request #33875 from tmp6154/master
Change order of arguments in assertion to be more logical
Upstream-commit: 87df0e533b619c088091fd1e2310e92bb9a24822
Component: engine
2017-06-30 14:46:11 -04:00
6a2cd2eda7 Merge pull request #33890 from ripcurld0/nesting_fix
Refactor MountPoint Setup function in volume.go
Upstream-commit: 2b20737778ff27b6b08b30912378931271c14eb8
Component: engine
2017-06-30 14:40:50 -04:00
96548baff2 Merge pull request #33882 from aaronlehmann/memdb-no-container
container: Handle failed memdb lookups
Upstream-commit: 18d874a20fccbd017e91cfaad31861b0953e22fa
Component: engine
2017-06-30 14:31:10 -04:00
56378645d0 Wait for device removal if deferredRemoval=true and deferredDeletion=false
There have been some cases where umount, a device can be busy for a very
short duration. Maybe its udev rules, or maybe it is runc related races
or probably it is something else. We don't know yet.

If deferred removal is enabled but deferred deletion is not, then for the
case of "docker run -ti --rm fedora bash", a container will exit, device
will be deferred removed and then immediately a call will come to delete
the device. It is possible that deletion will fail if device was busy
at that time.

A device can't be deleted if it can't be removed/deactivated first. There
is only one exception and that is when deferred deletion is on. In that
case graph driver will keep track of deleted device and try to delete it
later and return success to caller.

Always make sure that device deactivation is synchronous when device is
being deleted (except the case when deferred deletion is enabled).

This should also take care of small races when device is busy for a short
duration and it is being deleted.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 36cb6efebc599900b691e206fb9e99d3aa2fb9a3
Component: engine
2017-06-30 14:27:26 -04:00
3bd733bca1 Merge pull request #273 from adshmh/add-unit-tests-to-task-package
add unit tests to task package
Upstream-commit: 379b762495
Component: cli
2017-06-30 11:41:24 -04:00
cccb3a2108 add dev report 2017-06-26
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 8b0384fd8918e82459aab037d50bca6394bbf781
Component: engine
2017-06-30 17:19:40 +02:00
ab5c937cf4 Merge pull request #33824 from ijc/build-iidfile-with-squash
builder: Emit a BuildResult after squashing.
Upstream-commit: b8766fe793c18149e167b8f9819352a3bfcb0514
Component: engine
2017-06-30 16:42:23 +02:00
7e46ec7067 Make plugin removes more resilient to failure
Before this patch, if the plugin's `config.json` is successfully removed
but the main plugin state dir could not be removed for some reason (e.g.
leaked mount), it will prevent the daemon from being able to be
restarted.

This patches changes this to atomically remove the plugin such that on
daemon restart we can detect that there was an error and re-try. It also
changes the logic so that it only logs errors on restore rather than
erroring out the daemon.

This also removes some code which is now duplicated elsewhere.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 11cf394e5ea964636294a219872b188fe5bdf4dd
Component: engine
2017-06-30 09:58:19 -04:00
d97f0f6543 Merge pull request #268 from albers/completion-swarm-ca
Add bash completion for `swarm ca`
Upstream-commit: afcc75ddfe
Component: cli
2017-06-30 11:42:28 +02:00
41272f1b72 Add bash completion for network create --scope|--config-only|config-from
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 22579ba56c
Component: cli
2017-06-30 11:01:45 +02:00
5cf169cc6a Merge pull request #269 from albers/completion-swarm-init--data-path-addr
Fix bash completion for `swarm init|join --data-path-addr`
Upstream-commit: 9689ccab1b
Component: cli
2017-06-30 10:29:35 +02:00
88fc3881d6 Merge pull request #250 from albers/completion-service-create--detach
Add bash completion for `service create --detach`
Upstream-commit: b306817220
Component: cli
2017-06-30 01:16:19 -07:00
fb07a8e807 Merge pull request #256 from albers/completion-service-update-order
Add bash completion for `service create|update (update|rollback)-order`
Upstream-commit: c726ccaf6c
Component: cli
2017-06-30 01:12:57 -07:00
67050e7a6f Merge pull request #257 from albers/completion-service--network-add
Add bash completion for `service create|update --network-(add|rm)`
Upstream-commit: 321c692868
Component: cli
2017-06-30 01:11:22 -07:00
8d232fdb68 Refactor MountPoint Setup function in volume.go
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: fb8b27cd41c92c9a739be70dee11f6e6ffffafdf
Component: engine
2017-06-30 11:09:49 +03:00
1e38251e9a Merge pull request #251 from albers/completion-plugin-events
Add bash completion for plugin events
Upstream-commit: d1ccfcaf2a
Component: cli
2017-06-30 01:02:53 -07:00
72ce4394de Merge pull request #254 from albers/completion-system-prune--volumes
Add bash completion for `system prune --volumes`
Upstream-commit: 495ab9b3e9
Component: cli
2017-06-30 01:01:14 -07:00
46544e3ed0 Merge pull request #249 from albers/completion-fix-network-create--internal
Fix bash completion for `network create --internal`
Upstream-commit: b45c7d614e
Component: cli
2017-06-30 00:11:38 -07:00
b7f79e8cec Merge pull request #247 from albers/completion-service--entrypoint
Add bash completion for `service create|update --entrypoint`
Upstream-commit: 1c4d070cf5
Component: cli
2017-06-30 00:09:20 -07:00
57f1273555 Merge pull request #239 from albers/completion-network-create--ingress
Add bash completion for `docker network create --ingress`
Upstream-commit: 993b78d276
Component: cli
2017-06-30 00:05:44 -07:00
1a311235ba Always perform version-negotiation
If a client is initialized without a specific
version set, version negotiation would not be
functional.

This patch changes the behavior to always
perform version negotation (if called), in
which case the "current" (maximum supported
API version) is used as a default.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 5975dc4b4b8a6fa2e0edd1f1b113e7f66dad732b
Component: engine
2017-06-29 22:24:49 -07:00
5852d59e6d Fix NewVersionError() for clients using default version
The NewVersionError checks if the client is using the API version
required for using a specific feature.

If the client is initialized without setting a specific version, an
error would be generated because it was not possible to compare
versions. However, a client without explicit version set is running
the latest supported version.

This patch changes the behavior to only generate an error if a version
was set.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: ff2ed1853099a210245814b4263ce1c92b14c153
Component: engine
2017-06-29 22:22:32 -07:00
5edabea811 Merge pull request #233 from dnephin/build-stdin-with-compress
Build stdin with compress
Upstream-commit: 0b050a599f
Component: cli
2017-06-29 18:38:55 -07:00
358ed9d030 Merge pull request #244 from thaJeztah/tiny-builder-docs-improvements
Some builder docs improvements
Upstream-commit: 40a636efc1
Component: cli
2017-06-29 18:34:03 -07:00
60185c5eb3 container: Handle failed memdb lookups
If a container doesn't exist in the memdb, First will return nil, not an
error. This should be checked for before using the result.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: c26b0cdfd1a026af88fcfbed9d3c3acdd6d171a0
Component: engine
2017-06-29 16:33:30 -07:00
c71c867f51 middleware: Redact secret data on "secret create"
With debug logging turned on, we currently log the base64-encoded secret
payload.

Change the middleware code to redact this. Since the field is called
"Data", it requires some context-sensitivity. The URI path is examined
to see which route is being invoked.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 3fbc352cbbce06cd3001d6b14b2b1ebcb4d42cd5
Component: engine
2017-06-29 16:04:47 -07:00
04259ca4ac add unit tests to task package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 244e28f41f
Component: cli
2017-06-29 17:57:31 -04:00
05c34f9c1a Refactor caCommand
Split out a swarmCAOptions struct for options that are shared between
the ca and update commands.

Change the 'no trust root' message to an error.

Add some unit tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 81e9837859
Component: cli
2017-06-29 17:57:06 -04:00
129c66c19b Some builder docs improvements
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 29b419eed5
Component: cli
2017-06-29 14:20:16 -07:00
2f46157f44 Merge pull request #33873 from lixiaobing1/masterissue
update url for issue
Upstream-commit: 82390ebf32c3e48d80b862ffe46d4160aa65b728
Component: engine
2017-06-29 13:48:19 -07:00
e0679f41e0 Merge pull request #33827 from cpuguy83/return_ping_data_if_available
Set ping version even on error
Upstream-commit: 654bb6368b838bc619a5d612a39abb385fbd45c3
Component: engine
2017-06-29 12:27:23 -07:00
27d5d2149c Compress after rewriting the archive.
Write a test showing compress failure.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a04aa8fe28
Component: cli
2017-06-29 13:18:10 -04:00
d8218cc6ef Merge pull request #227 from dnephin/expose-config
expose config credentials without needing the Cli
Upstream-commit: 74af31be7f
Component: cli
2017-06-29 19:11:37 +02:00
85421deb82 Set ping version even on error
In some cases a server may return an error on the ping response but
still provide version details. The client should use these values when
available.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 27ef09a46ffeb8ba42548de937b68351009f30ea
Component: engine
2017-06-29 12:42:14 -04:00
c54c912237 Merge pull request #238 from vdemeester/update-go-connections
Update go-connections dependency
Upstream-commit: 8de604c857
Component: cli
2017-06-29 18:04:27 +02:00
38c47208e6 Merge pull request #255 from albers/system-prune-volume-warning
system prune: only warn for volumes if --volumes is given
Upstream-commit: 64486d7820
Component: cli
2017-06-29 08:50:16 -07:00
4815e9227a Fix bash completion for swarm init|join --data-path-addr
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: fa4dc8820a
Component: cli
2017-06-29 16:45:18 +02:00
7c199971a1 Add bash completion for swarm ca
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 5bd00a563e
Component: cli
2017-06-29 16:28:50 +02:00
1296f00c8a Merge pull request #33860 from lixiaobing1/masterFclose
add f.Close()  after dockerignore.ReadAll(f) before return err
Upstream-commit: e066edcfcfec3b6c4ad61a6a769174453968d62d
Component: engine
2017-06-29 10:19:45 -04:00
8ae901a8e8 Merge pull request #33647 from johnstep/improve-load-error
Stop trying to load images on an incompatible OS
Upstream-commit: 5fbc82128b42871734f35b468d410ba182ada917
Component: engine
2017-06-29 16:12:32 +02:00
8e64767c1e Merge pull request #33831 from cpuguy83/ignore_enotsup_on_relabel
Do not error on relabel when relabel not supported
Upstream-commit: 1ca83a6595f1c44b8643714082d2ec0e597d788c
Component: engine
2017-06-29 10:08:47 -04:00
89b4b291d7 Merge pull request #33867 from nishanttotla/fix-duplicate-platform-info
Do not add duplicate platform information to service spec
Upstream-commit: fcaa79b842b2e1e64784db8568334bb656a9b99e
Component: engine
2017-06-29 09:36:01 -04:00
7b10a8b5c9 system prune: only warn about volumes if --volumes is given
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 849b0e96a0
Component: cli
2017-06-29 15:07:21 +02:00
0b353a6204 Change order of arguments in assertion to be more logical
Because of argument order to assert, in case of fail, we'll get message
like:

... obtained string = "uid=100(test) gid=101(test)\n"
... expected string = "uid=100(test) gid=101(test) groups=101(test)\n"

But obtained string should be second one, not the first one. And
expected string should be first. Here's sample output from test above:

... Output: before restart 'uid=100(test) gid=101(test)
', after restart 'uid=100(test) gid=101(test) groups=101(test)

It's confusing, because expected order of strings in assertion is
reversed. What goes before restart - should be "expected string" and
what goes after - should be "obtained string".

Signed-off-by: Vitaly Ostrosablin <vostrosablin@virtuozzo.com>
Upstream-commit: 07cc701947533089fac5fea42e7d5a9a6ea1cfcc
Component: engine
2017-06-29 12:38:13 +03:00
53df97e881 update url for issue
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Upstream-commit: 6fcae83036970dd2aad73127da6cbd0d2becb333
Component: engine
2017-06-29 17:10:02 +08:00
d76f67a9f8 add f.Close() after dockerignore.ReadAll(f) before return err
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 3072fce0671c5529a42b9e40a5344cce99318312
Component: engine
2017-06-29 00:51:31 -07:00
2483818fef Merge pull request #262 from cdrage/on-failure-error
on_failure -> on-failure in compose code
Upstream-commit: 4c88a1cb53
Component: cli
2017-06-29 09:04:15 +02:00
fcdcc589ed Merge pull request #258 from adshmh/fix-daemon-unit-tests-output-leak
fixed output leak from daemon unit tests
Upstream-commit: e4e08baeba
Component: cli
2017-06-29 09:03:51 +02:00
cc179a2f74 Merge pull request #33851 from tonistiigi/fix-add-remote
build: fix add from remote url
Upstream-commit: b7ac1571a35ce0df42cf96b0ed91f20c33678d31
Component: engine
2017-06-28 23:53:21 -07:00
7c4267f69a progress: Add unit tests
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: dd3eae84e1
Component: cli
2017-06-28 17:53:56 -07:00
30ba67aee0 Do not add duplicate platform information to service spec
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: da85b62001ec390bdc30b321c4a5cd23c17eeb81
Component: engine
2017-06-28 16:01:05 -07:00
5570d38a23 Merge pull request #215 from imkin/default-max-size-param-doc
Adding docs for "overlay2.size" storage-opt
Upstream-commit: 0ec3e8a8d5
Component: cli
2017-06-28 14:23:34 -07:00
400dd10c7d Merge pull request #33809 from Microsoft/jjh/svmdedicatedscratch
LCOW: Dedicated scratch space for service VM utilities
Upstream-commit: 8b29ba59ccdd4de45fa25137ec5d5a3845f5f5cc
Component: engine
2017-06-28 11:06:46 -07:00
77cf31b37e add test for filesync path filtering and testutil helper
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 4141d8fe5da596e7ee1eec217378aeb684d0a99e
Component: engine
2017-06-28 09:12:36 -07:00
1c25f0d80a builder: enable path filtering for filesync session
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: ad46348d7c9f8a84d61e1ba5f08c8fd0727e4ebc
Component: engine
2017-06-28 09:12:30 -07:00
f397c29ebe on_failure -> on-failure in compose code
on_failure should be on-failure

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
Upstream-commit: d3f9a6c610
Component: cli
2017-06-28 11:10:02 -04:00
6a011203cd Merge pull request #33857 from yongtang/33856-make-test-unit
Fix build error for `make test-unit`
Upstream-commit: 3d6ab220db348d82310487e3156d445f19dc0661
Component: engine
2017-06-28 00:31:42 -07:00
d034f04bc4 Merge pull request #260 from aaronlehmann/verify-message
progress: Show success message when finished counting down
Upstream-commit: 92a2a1d539
Component: cli
2017-06-28 09:30:49 +02:00
241ddf7729 Adding docs for "overlay2.size" storage-opt
Signed-off-by: Dhawal Yogesh Bhanushali <dbhanushali@vmware.com>
Upstream-commit: ff2552f7a1
Component: cli
2017-06-27 23:58:57 -07:00
08b4e324e5 Merge pull request #33826 from Microsoft/jjh/lcownits
LCOW: Fix nits from 33241
Upstream-commit: 950d472c9ce4180b80e28030f7de68ffc3254f97
Component: engine
2017-06-27 22:56:38 -07:00
7a07cf4db4 Fix build error for make test-unit
This fix tries to address the issue raised by #33856 where
`make test-unit` will result in the failure:
```
...
...
dockerversion/useragent.go:20: undefined: Version
dockerversion/useragent.go:22: undefined: GitCommit
ok  	github.com/docker/docker/api	0.026s	coverage: 68.0% of statements
ok  	github.com/docker/docker/api/errors	0.003s	coverage: 100.0% of statements
FAIL	github.com/docker/docker/api/server [build failed]
make: *** [test-unit] Error 2
```

The issue is because in case of `make test-unit`, `source "${MAKEDIR}/.go-autogen"`
is missing.

This caused the `make test-unit` failure.

This fix adds `source "${MAKEDIR}/.go-autogen"` in `hack/make/test-unit`

This fix fixes #33856.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: fac486d0a02d6af2759f6d0e81bd8a23d82d432c
Component: engine
2017-06-28 03:18:55 +00:00
674cb1c136 Merge pull request #32977 from imkin/30491-default-container-size
Add overlay2.size daemon storage-opt
Upstream-commit: acf855bf10e16b4282cb14f6cc34e378831a22c8
Component: engine
2017-06-27 20:00:02 -07:00
ca3c2320e6 Merge component 'cli' from git@github.com:docker/cli master 2017-06-28 01:54:52 +00:00
22fa507f87 Merge component 'engine' from git@github.com:moby/moby master 2017-06-28 01:51:55 +00:00
b057843522 progress: Show task error in place of progress bar
If a task encounters an error, the interactive "service create" and
"service update" commands should show that error instead of showing a
stuck progress bar.

To validate:

docker service create --detach=false --name broken --restart-condition=none --replicas 3 busybox asdf
and
docker service create --detach=false --name broken --mode global --restart-condition none busybox asdf

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 1ef585f65d
Component: cli
2017-06-27 15:12:31 -07:00
ad9f81da7f progress: Show success message when finished counting down
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 82e069026b
Component: cli
2017-06-27 15:07:10 -07:00
8266f5c84f Merge pull request #33838 from lixiaobing1/masterRange
optimize for loop with rootfs.DiffIDs
Upstream-commit: 74a5b14c80022392c17100e1cde6727842eceb6f
Component: engine
2017-06-27 14:34:10 -07:00
9a5747b3f9 LCOW: Fix nits from 33241
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 4ec9766a27ffb964cec6b8b2745725965b2644aa
Component: engine
2017-06-27 11:59:49 -07:00
2bf9a1e1f5 fixed the output leak from daemon unit tests
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 69b226a89c
Component: cli
2017-06-27 14:22:49 -04:00
92d764e7fb LCOW: Dedicated scratch space for global service VM
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: d1d649c891c8b06567afba7542ea9bf518cdaa02
Component: engine
2017-06-27 10:55:16 -07:00
4c52cfc0fb build: fix add from remote url
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 2981667e11e24e9e1e61252a40ceb11fd7cb9811
Component: engine
2017-06-27 10:38:01 -07:00
59255c95cd Merge pull request #33832 from glasser/glasser/msg-source
Fix stderr logging for journald and syslog
Upstream-commit: 7843bfde36d9ded6fada32f469fe1790316137ae
Component: engine
2017-06-27 13:30:41 -04:00
50b9ac741e Merge pull request #33690 from raja-sami-10p/pkg/authorization
Increase test Coverage of pkg/authorization
Upstream-commit: 48e625ccca176787d56a6e87a0e2cc779ce5b6d3
Component: engine
2017-06-27 10:09:13 -07:00
37752ce207 add --detach to docker scale
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 6c6b1091d9
Component: cli
2017-06-27 09:55:10 -07:00
d4b74e4fd3 Add bash completion for service create|update --network-(add|rm)
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: fa0f470a5f
Component: cli
2017-06-27 17:43:05 +02:00
2d54e9fa16 Add bash completion for service create|update (update|rollback)-order
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 71dd0e0b66
Component: cli
2017-06-27 17:32:43 +02:00
e3e93a641f Merge pull request #33696 from thaJeztah/fix-git-clone
Fix handling of remote "git@" notation
Upstream-commit: 151c5ea798c476128708a91fda8644a6889c2091
Component: engine
2017-06-27 16:56:11 +02:00
7fb6cb009c Add bash completion for system prune --volumes
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 36b572dfdf
Component: cli
2017-06-27 16:37:41 +02:00
ac616d52fb Rename NewConfigFile to New in configfile package
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 105b21d1ab
Component: cli
2017-06-27 16:31:38 +02:00
55b50a2ecf Add bash completion for plugin events
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: f0f7150537
Component: cli
2017-06-27 15:37:14 +02:00
41493b0fad optimize for loop with rootfs.DiffIDs
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
Upstream-commit: 80b2c326de29552c6ee4072fca75ae00eb3be41a
Component: engine
2017-06-27 20:31:27 +08:00
284dc93fb1 Add missing unit tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 62dfbef4d8
Component: cli
2017-06-27 13:46:47 +02:00
2f4e7d39ca Move credential getting functions to the ConfigFile.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a3cbc70147
Component: cli
2017-06-27 13:46:47 +02:00
c380487034 Cleanup config/credentials, remove dependency on config file.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 33cbb70270
Component: cli
2017-06-27 13:45:50 +02:00
4682e5be27 Move config file loading to more appropriate packages.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a8c70e43a3
Component: cli
2017-06-27 13:45:50 +02:00
098742e654 Add bash completion for service create --detach
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 8baef1098e
Component: cli
2017-06-27 12:58:38 +02:00
7a7da398c1 Fix bash completion for network create --internal
`--internal` is a boolean option. It was falsely treated as non-boolean.

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 12dc9eb11f
Component: cli
2017-06-27 12:39:27 +02:00
7612cca1fe Add bash completion for service create|update --entrypoint
Also fixes a wrong option: `--arg` should be `--args`.

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: e0462e8472
Component: cli
2017-06-27 11:54:05 +02:00
b6d365bb3f Add bash completion for label filter of prune commands
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 8b99b65ca8
Component: cli
2017-06-27 11:28:52 +02:00
359031100e Add overlay2.size daemon storage-opt
This commit adds the overlay2.size option to the daemon daemon
storage opts.

The user can override this option by the "docker run --storage-opt"
options.

Signed-off-by: Dhawal Yogesh Bhanushali <dbhanushali@vmware.com>
Upstream-commit: a63d5bc03513755015827d0fe93563240429f1e0
Component: engine
2017-06-27 01:07:48 -07:00
7ef86a57f5 Merge pull request #33835 from Microsoft/jjh/changedir
LCOW: Change directory from lcow to "Linux Containers"
Upstream-commit: 359ed993525eecb5009c7be1a48a9d646a9e235f
Component: engine
2017-06-27 09:33:38 +02:00
e2c85453e0 Merge pull request #33815 from jstarks/lcow_command_args
LCOW: pass command arguments without extra quoting
Upstream-commit: bcc8b2bc474ef2536bd4bac93a7b94935efaf57a
Component: engine
2017-06-26 21:46:29 -07:00
02efb01414 LCOW: Change to c:\Program Files\Linux Containers
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 2c43cbe0d5132618c74de4631c89c541bbafb8c2
Component: engine
2017-06-26 21:26:18 -07:00
1c03f9a249 Vendor github.com/jhowardmsft/opengcs v0.0.7
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 3f14e25a7f67e0236dfdcde792ac571ca7874c47
Component: engine
2017-06-26 21:24:39 -07:00
59836240bc Merge pull request #230 from mstanleyjones/remove-userns-details
Remove specific config info about userns-remap
Upstream-commit: 2eac0bb7b7
Component: cli
2017-06-26 21:11:53 -07:00
146ac6efc7 Merge pull request #225 from mstanleyjones/ps-markdown-formatting
Reformat filtering options in ps ref
Upstream-commit: 8fc3179111
Component: cli
2017-06-26 21:05:42 -07:00
f453764eee Merge pull request #207 from cyli/warn-swarm-ca-command
If `docker swarm ca` is not called with the `--rotate` flag, warn if other flags are passed
Upstream-commit: cfff0e2259
Component: cli
2017-06-26 20:56:54 -07:00
0fcd0709a5 Merge pull request #219 from vieux/scale
hide `--detach` for docker < 17.05
Upstream-commit: c3e5445659
Component: cli
2017-06-26 20:47:39 -07:00
5323af3564 hide --detach for docker < 17.05
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: db60f25561
Component: cli
2017-06-26 18:55:30 -07:00
442b559ba0 Merge pull request #31497 from dnephin/engine-local-image-data
Add a LastTagTime for images
Upstream-commit: 8f3c526e7851e047f5dde31bd2ce69f960e1d115
Component: engine
2017-06-26 18:51:09 -07:00
bc7c33134c Merge pull request #231 from tonistiigi/client-session-fssession
Incrementally sending build context
Upstream-commit: 0133e13353
Component: cli
2017-06-26 17:15:34 -07:00
99068fccc9 Merge pull request #237 from aaronlehmann/progress-before-assignment
progress: Show progress of replicated tasks before they are assigned
Upstream-commit: 2f58992f85
Component: cli
2017-06-26 17:14:07 -07:00
f1b5e42df0 Use long running session in builder
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Add incremental context send support

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: b95638a5ac
Component: cli
2017-06-26 16:30:01 -07:00
6fc578b05f Add builder dev report for 2017-06-26
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 294095d07e9d524a3add4afab3a9005a79a47015
Component: engine
2017-06-26 16:10:03 -07:00
525974b970 Merge pull request #33781 from mlaventure/fix-healhcheck-goroutine-leak
Prevent a goroutine leak when healthcheck gets stopped
Upstream-commit: da28210a157a3bf5662f1a049bb10f9b69d2a5a2
Component: engine
2017-06-26 15:34:43 -07:00
836d4632cb Stop trying to load images on an incompatible OS
Signed-off-by: John Stephens <johnstep@docker.com>
Upstream-commit: b9255e4a531d2ad0239481eba2a635f7d48718fb
Component: engine
2017-06-26 15:11:24 -07:00
29123f2ea7 Fix stderr logging for journald and syslog
logger.PutMessage, added in #28762 (v17.04.0-ce), clears msg.Source. So journald
and syslog were treating stderr messages as if they were stdout.

Signed-off-by: David Glasser <glasser@davidglasser.net>
Upstream-commit: 917050c5728f2fb9958ccb3ab66a23766f741adc
Component: engine
2017-06-26 14:37:43 -07:00
5a81510449 Do not error on relabel when relabel not supported
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: ebfdfc5768b74e0a52875cf76a0576bfcd66445c
Component: engine
2017-06-26 17:29:24 -04:00
daace4e1a1 Merge pull request #241 from mstanleyjones/master
Fix false Liquid errors
Upstream-commit: 3648a8b9d0
Component: cli
2017-06-26 13:19:04 -07:00
6c88b7bdd9 Fix false Liquid errors
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Upstream-commit: 11c1729e00
Component: cli
2017-06-26 12:50:34 -07:00
f5f8240661 Set a LastUpdated time in image metadata when an image tag is updated.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 016eea004ba0109d7cd965eab242ed17e4f0f36c
Component: engine
2017-06-26 12:16:26 -07:00
a8f8b4ccd8 Move IsGitTransport() to gitutils
This function was only used inside gitutils,
and is written specifically for the requirements
there.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: d3d1aabcc68f65d40acbf1b3adc02d13997bb8e2
Component: engine
2017-06-26 10:07:04 -07:00
8170be09ea Fix handling of remote "git@" notation
`docker build` accepts remote repositories
using either the `git://` notation, or `git@`.

Docker attempted to parse both as an URL, however,
`git@` is not an URL, but an argument to `git clone`.

Go 1.7 silently ignored this, and managed to
extract the needed information from these
remotes, however, Go 1.8 does a more strict
validation, and invalidated these.

This patch adds a different path for `git@` remotes,
to prevent them from being handled as URL (and
invalidated).

A test is also added, because there were no
tests for handling of `git@` remotes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 913eb99fdcd26a4106250bd40dfe8b9c18564b23
Component: engine
2017-06-26 10:02:12 -07:00
2396f04d09 Merge pull request #33814 from vdemeester/update-go-connections
Update go-connections dependency
Upstream-commit: 33fd3817b0f5ca4b87f0a75c2bd583b4425d392b
Component: engine
2017-06-26 10:24:04 -04:00
1c2b78478c builder: Emit a BuildResult after squashing.
This ensures that the final BuildResult is the actual tagged image.

Fixes #33822.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
Upstream-commit: 9777ec3be0e3056d0bedcf36052704f832e45759
Component: engine
2017-06-26 13:19:25 +01:00
1f11d8b4bd Add bash completion for network create --ingress
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: e4f9ad77c8
Component: cli
2017-06-25 00:27:14 +02:00
9b81483a89 Enable bash completion in development container
Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: cec5ca75e1ba2e05095a5ff072c3738684575d86
Component: engine
2017-06-24 23:51:06 +02:00
a08baae726 LCOW: pass command arguments without extra quoting
Signed-off-by: John Starks <jostarks@microsoft.com>
Upstream-commit: 19645521a92869be7210fb663ed5e0e82e329ca5
Component: engine
2017-06-24 10:23:17 -07:00
aaa2288536 Merge pull request #33798 from vdemeester/move-some-api-code-away
Move some `api` package functions away
Upstream-commit: d311a3a681f918906249a1678eab0136ac663f6e
Component: engine
2017-06-24 14:30:25 +02:00
3172848991 Update go-connections dependency
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 497e6e0caaf805f8693c35cb45edbc8f734f09f2
Component: engine
2017-06-24 12:40:49 +02:00
6e00d88916 Update go-connections dependency
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 9f34e340b3
Component: cli
2017-06-24 12:40:26 +02:00
d0a0bd4e19 Merge pull request #235 from vdemeester/234-fix-warn
Add a line break after warning 👼
Upstream-commit: 298d486d8b
Component: cli
2017-06-24 02:17:26 -07:00
d532fc19ff Merge pull request #33812 from thaJeztah/cleanup-gitignore
Cleanup gitignore
Upstream-commit: 5e2004c1b9e1cab4b2ac3ba7c8edfd959a67c836
Component: engine
2017-06-24 01:34:40 -07:00
7efc650625 Merge pull request #33674 from raja-sami-10p/pkg/templates
Increase test Coverage of pkg/templates
Upstream-commit: 4964b092384a0e1c42b2db728aeeaf129a50f54f
Component: engine
2017-06-24 01:04:24 -07:00
ee1b2dfe8c Merge pull request #33467 from bschwind/copy-documentation
Add note to CopyToContainer documentation
Upstream-commit: 5564fad4068619e7d0c5fd7defe7dd5e3f0edd8c
Component: engine
2017-06-24 00:19:51 -07:00
ea9175efe5 Cleanup gitignore
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: a7b24296c8ad7928ba56a4c2ecd675a34934177d
Component: engine
2017-06-23 23:04:39 -07:00
c842c1cbcc Merge pull request #33801 from albers/completion-dev-environment
Add bash completion to the development container
Upstream-commit: 94e9cb13f436509e0c64a17df16b4e9cad536704
Component: engine
2017-06-23 22:52:14 -07:00
c080f953a4 Merge pull request #33719 from dnephin/warn-on-empty-continuation-carry
[Builder] Warn on empty continuation lines
Upstream-commit: 8d1ae76dcbbb73d8e20c6a14a7d3fe2410b95f55
Component: engine
2017-06-23 22:52:02 -07:00
8e27989c88 Merge pull request #33707 from Syntaxide/s3fix
Fix authorization header handling in downloader script.
Upstream-commit: d75eb735eee26521b76c732f8b07cfaf6c460d12
Component: engine
2017-06-23 20:27:54 -07:00
8065c10b0c Merge pull request #33698 from cpuguy83/dm_deferred_delete_default
Enable dm deferred_* with version check
Upstream-commit: 5b54e78947a5ab8b4c9e60179b205a82227944e4
Component: engine
2017-06-23 19:30:05 -07:00
3b769b27be progress: Show progress of replicated tasks before they are assigned
This was only showing tasks that belong to nodes that are currently up,
so that tasks on down nodes don't appear to be stuck. But this
unintentionally excludes tasks that haven't been assigned yet, so if a
task is stuck before assignment, for example because no nodes meet its
constraints, a progress bar won't even be shown. The check should only
apply to tasks that have a node assignment.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: d3d09f67b1
Component: cli
2017-06-23 17:34:59 -07:00
4302a48fed Merge component 'engine' from git@github.com:moby/moby master 2017-06-24 00:04:09 +00:00
ec6218872a fix build issue with updated moby
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: ae8d049f9e
Component: cli
2017-06-23 16:12:20 -07:00
5b78ab86a3 Merge pull request #31273 from fabiokung/consistent-ro-view
No container locks on `docker ps`
Upstream-commit: 56ad9bb1b4f7463cf1d6eab8b6f924f46ff2c2fe
Component: engine
2017-06-23 15:28:55 -07:00
7a0490e85b Merge pull request #33804 from clnperez/fix-cli-test-autogen
Fix autogen vars
Upstream-commit: 6e96eec565664a261fd641a6807c3c5e17ffefff
Component: engine
2017-06-23 15:28:29 -07:00
22a8e5a387 Merge component 'cli' from git@github.com:docker/cli master 2017-06-23 22:23:52 +00:00
c2312e39f5 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-06-23 22:22:32 +00:00
d317d39474 Merge pull request #28 from StefanScherer/link-packaging-repo
Add link to docker-ce-packaging repo
2017-06-23 14:01:53 -07:00
553c4b8a9b Merge pull request #33785 from Microsoft/jjh/hcsschemaupdate
LCOW: Updates necessary due to platform schema change
Upstream-commit: 25a65a185b6b512117803ab25c716ca8f831ccdf
Component: engine
2017-06-23 13:08:13 -07:00
34f4d1d4f0 Fix autogen vars
commit ea2e4d73c4c753cdc99966e4dfe35143e79564ce removed the autogen
script, but if you happen to clone the dir fresh from git, you can't
build the integration test binaries.

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
Upstream-commit: 091e07c87d7dc9130e4f9b0f68342bb07c79ba2f
Component: engine
2017-06-23 14:40:09 -05:00
a2d1e59fe3 Merge pull request #236 from vdemeester/import-displayable-ports-from-moby
Import DisplayablePorts from moby/moby source
Upstream-commit: 8b6196ded7
Component: cli
2017-06-23 15:01:53 -04:00
d33398c2c4 vendor: update moby
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 4adf701567
Component: cli
2017-06-23 11:34:22 -07:00
a254f57702 Fix cyclomatic complexity of two formatters
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c60d13e539
Component: cli
2017-06-23 11:34:22 -07:00
61f81c51e1 Add a line break after warning 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: b7fad8f1dc
Component: cli
2017-06-23 20:15:00 +02:00
a9a5f68c49 Import DisplayablePorts from moby/moby source
This has nothing to do in the `api` package for moby as it's just a
cli display function.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 9e142cadc9
Component: cli
2017-06-23 20:12:30 +02:00
cbfdedc6bd Move some api package functions away
- DisplayablePorts is a `cli` function, moving to `docker/cli`
- Move MatchesContentType to the only package using it,
  `api/server/httputils` (and remove the deps on logrus for `api` package)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 565aa41392b01251dfc9398eb69c23bdd8ea64e6
Component: engine
2017-06-23 19:37:26 +02:00
0a2d82735e Add a test for warning on empty continuation lines.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b47b375cb8bb0dca7ee0ebfa093bfc163ad867fb
Component: engine
2017-06-23 13:15:04 -04:00
78a82a7623 Warn/deprecate continuing on empty lines in Dockerfile
This fix is related to 29005 and 24693. Currently in `Dockerfile`
empty lines will continue as long as there is line escape before.
This may cause some issues. The issue in 24693 is an example.
A non-empty line after an empty line might be considered to be a
separate instruction by many users. However, it is actually part
of the last instruction under the current `Dockerfile` parsing
rule.

This fix is an effort to reduce the confusion around the parsing
of `Dockerfile`. Even though this fix does not change the behavior
of the `Dockerfile` parsing, it tries to deprecate the empty line
continuation and present a warning for the user. In this case,
at least it prompt users to check for the Dockerfile and avoid
the confusion if possible.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 7815c8f8754d5473eda7cd80277a4ea3c59e3c29
Component: engine
2017-06-23 13:04:40 -04:00
d2f6c7daee Add bash completion to the development container
Adds an environment variable `DOCKER_BASH_COMPLETION_PATH` that allows to
include a bash completion script into the development container.

This is needid for development of bash completion.

Signed-off-by: Harald Albers <github@albersweb.de>
Upstream-commit: 0e2c424a7f32945a47e271cb804b091c83429912
Component: engine
2017-06-23 18:11:55 +02:00
2c8425881b Prevent a goroutine leak when healthcheck gets stopped
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 67297ba0051d39be544009ba76abea14bc0be8a4
Component: engine
2017-06-23 08:06:49 -07:00
55b5e8b06f Net operations already hold locks to containers
Fix a deadlock caused by re-entrant locks on container objects.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 37addf0a50ccba51630368c6ed09eb08166d6f48
Component: engine
2017-06-23 07:52:35 -07:00
cd24ef2d4a avoid saving container state to disk before daemon.Register
Migrate legacy volumes (Daemon.verifyVolumesInfo) before containers are
registered on the Daemon, so state on disk is not overwritten and legacy
fields lost during registration.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 76d96418b13080514f3fb861072b06cb91d71cff
Component: engine
2017-06-23 07:52:34 -07:00
60fed1f9a7 delete unused code (daemon.Start)
Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 66b231d598174986ad08236f0a38beb825e5a3c3
Component: engine
2017-06-23 07:52:34 -07:00
69f8ddc123 ensure heath monitor status updates are propagated
initHealthMonitor and updateHealthMonitor can cause container state to
be changed (State.Health).

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 04bd768a889f94a4dc6ad25e2a014dffd0a4e04e
Component: engine
2017-06-23 07:52:34 -07:00
9755d1918d avoid re-reading json files when copying containers
Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: a43be3431e51b914ab170569b9e58239d64b199c
Component: engine
2017-06-23 07:52:34 -07:00
b8affe908f only Daemon.load needs to call label.ReserveLabel
Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 9134e87afc6f3215a58d23c7261242b764357501
Component: engine
2017-06-23 07:52:33 -07:00
940ce3d71d save deep copies of Container in the replica store
Reuse existing structures and rely on json serialization to deep copy
Container objects.

Also consolidate all "save" operations on container.CheckpointTo, which
now both saves a serialized json to disk, and replicates state to the
ACID in-memory store.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: edad52707c536116363031002e6633e3fec16af5
Component: engine
2017-06-23 07:52:33 -07:00
666b1f6a5b no need to save container state here
it is already being saved (with a lock held) on the subsequent
operations.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: f668af4475980e32c99503c4a513668c24ea2da6
Component: engine
2017-06-23 07:52:33 -07:00
debc6bf90d verifyVolumesInfo needs a container lock
It operates on containers that have already been registered on the
daemon, and are visible to other goroutines.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 201a37f7a110402a76ac1ee21b5d09ccffed2acb
Component: engine
2017-06-23 07:52:33 -07:00
a2b99b3d6c no need to save state to disk here
State will be saved on the following operation once the container is
properly registered on the daemon.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 03aa24721c88e508f208c1ff72d8cd1af7e6a0f8
Component: engine
2017-06-23 07:52:32 -07:00
84bdea3f4f how to maintain the container snapshot struct
Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 2ed6f9257a0ccb81583e65bf8af0e00f8e2dedcb
Component: engine
2017-06-23 07:52:32 -07:00
9bf8a3a581 Make tests a bit less flaky
Prevent tests failing when teardown tries to delete a container that is
already being removed.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: fcb6d37a8dde8a91896116742116e9d9808b18ac
Component: engine
2017-06-23 07:52:32 -07:00
ae145558ae Move checkpointing to the Container object
Also hide ViewDB behind an inteface.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: aacddda89df05b88a6d15fb33c42864760385ab2
Component: engine
2017-06-23 07:52:32 -07:00
8111997a67 stop grabbing container locks during ps
Container queries are now served from the consistent in-memory db, and
don't need to grab a lock on every container being listed.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 8e425ebc422876ddf2ffb3beaa5a0443a6097e46
Component: engine
2017-06-23 07:52:31 -07:00
8889d56b70 keep a consistent view of containers rendered
Replicate relevant mutations to the in-memory ACID store. Readers will
then be able to query container state without locking.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: eed4c7b73f0cf98cf48943da1c082f3210b28c82
Component: engine
2017-06-23 07:52:31 -07:00
ad08f8c7af in-memory ACID store for containers
This can be used by readers/queries so they don't need locks.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 054728b1f555892c6c0bfd7abfbaeb2fedbc8f10
Component: engine
2017-06-23 07:24:11 -07:00
8cedd0fee9 Move platform specific mount data to Container
The Solaris version (previously daemon/inspect_solaris.go) was
apparently missing some fields that should be available on that
platform.

Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: cfc404a375817125e4b32a9cd6a4ec7e3c55dc4e
Component: engine
2017-06-23 07:22:47 -07:00
f79cf3c340 Merge pull request #221 from dnephin/fix-lint-errors
Fix lint errors merged while new lint branch was in PR
Upstream-commit: 0c6b8d717d
Component: cli
2017-06-23 09:54:12 +02:00
c41db1dd55 fd leak and error handling
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Upstream-commit: 0042f992d80b59b97380bbbbeb271fd3030edd90
Component: engine
2017-06-23 15:38:35 +08:00
9a5b3d1ecf Increase test Coverage of pkg/templates
Signed-off-by: Raja Sami <raja.sami@tenpearls.com>
Upstream-commit: 27e771b714b599c449c8fb8f01547454912aeb28
Component: engine
2017-06-23 12:38:33 +05:00
0ada256ac5 Merge pull request #232 from dnephin/fix-circle-git
Use an image with git and ssh for circleCI
Upstream-commit: ca8e991469
Component: cli
2017-06-23 09:37:18 +02:00
a79192f925 Increase test Coverage of pkg/authorization
Signed-off-by: Raja Sami <raja.sami@tenpearls.com>
Upstream-commit: f1eb0c0ebb85af2ae5373f16fd529588c07815cc
Component: engine
2017-06-23 12:35:46 +05:00
b7706d3788 Merge pull request #202 from ripcurld0/fix_32235_moby
Unmarshal a number as a Number in RawInspectFallback
Upstream-commit: aefbc9d8f7
Component: cli
2017-06-22 23:12:50 -07:00
f3a5ac7e36 Merge pull request #33653 from raja-sami-10p/pkg/streamformatter
Increase the Coverage of pkg/streamformatter
Upstream-commit: db57b85fcbe01ab195b48da3d715fdb4e1d4f9e8
Component: engine
2017-06-22 19:52:02 -07:00
38ce10a9ac Vendor jhowardmsft/opengcs v0.0.4
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: c75db46d5b4faae326793b7c6c5fc35be39fca7d
Component: engine
2017-06-22 19:28:49 -07:00
35bda9cb09 Vendor Microsoft/hcsshim v0.5.25
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 9508c605d882a5981a480ab0a07cc9b77568b4d8
Component: engine
2017-06-22 19:28:43 -07:00
e63e0a4f81 Merge pull request #33786 from thaJeztah/interactive-build-sessions
Documentation updates for interactive sessions
Upstream-commit: 2ef8936d8e060fa071e8d1422f9260e63c55f737
Component: engine
2017-06-22 18:11:52 -07:00
1ff0d7b31f Merge pull request #33738 from fcrisciani/libnetwork-vendoring
Libnetwork vendoring
Upstream-commit: 9f5f3e49dae981736b37bf3d18592c2ce4029644
Component: engine
2017-06-22 17:41:46 -07:00
797b9c7a2d Use an image with git and ssh for circleCI
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 74c1388f66
Component: cli
2017-06-22 19:51:36 -04:00
f565ab7c75 Merge pull request #33773 from aaronlehmann/vendor-swarmkit-79381d0
Vendor swarmkit 79381d0
Upstream-commit: 4d0c01ac17933ee0c8b94bc2beea5965377d42ef
Component: engine
2017-06-22 16:26:34 -07:00
ae62a09f9b Update "download-frozen-image-v2.sh" such that redirects are optional
If the registry responds directly with blob contents, use them,
otherwise follow the redirect without Authorization headers (which
likely aren't valid for the server being redirected to).

This preserves the basic structure of the previous output with up to one
additional progress bar per-layer (for the redirect request and then the
following blob request).

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
Upstream-commit: 4bbdc0b8f7b2faa3354738c300cfedb2b77c7316
Component: engine
2017-06-22 15:54:50 -07:00
862be7247c Update downloader script, to ensure that Authorization header is not passed when downloading blobs.
Signed-off-by: Alexander Midlash <amidlash@docker.com>
Upstream-commit: 5c38e4c16a0a51a0cffb4802ecc694e5f5bfbeed
Component: engine
2017-06-22 15:54:50 -07:00
3821f2cd57 Documentation updates for interactive sessions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: b8b8a9c837889c8851aade242ab1a1be0a8e7cf4
Component: engine
2017-06-22 15:36:56 -07:00
9b6e155e52 Remove specific config info about userns-remap
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Upstream-commit: 8222baf263
Component: cli
2017-06-22 15:09:14 -07:00
2bad9e6e8b Merge pull request #32677 from tonistiigi/builder-remote-context-4
Implement long running interactive session and sending build context incrementally
Upstream-commit: 050c1bb17bd033e909cb653f5449b683608293d6
Component: engine
2017-06-22 14:38:47 -07:00
c54a797733 LCOW: Update for platforms latest schema
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 330913cadf1fcca00be4b6b841ceb8d14471f470
Component: engine
2017-06-22 14:07:23 -07:00
908bb4d956 Improve routes initialization
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 8f68adfaf0231ded0ba6bd2ec522711752031885
Component: engine
2017-06-22 11:52:43 -07:00
e529bcd027 Implement incremental file sync using client session
Also exposes shared cache and garbage collection/prune
for the source data.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 5c3d2d552b0430672d5f481ab2d37036f6e92166
Component: engine
2017-06-22 11:52:35 -07:00
0051caf8c8 vendor: update deps for fssession
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 7cfcf74a907bb1fce63e95761c7e1ac70cb9e5df
Component: engine
2017-06-22 11:22:42 -07:00
6553b6419b session: update swagger yaml
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 4f51ca1e825072d89762a1a5273e714196910d90
Component: engine
2017-06-22 11:22:42 -07:00
b1e4d7d884 Add long-running client session endpoint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: ec7b6238c31e26702ecf366731532e189b5da142
Component: engine
2017-06-22 11:22:41 -07:00
bfc36e79fd Merge pull request #33764 from keloyang/fix-queue-mem-leak
Fix mem leak in libcontainerd/queue/append
Upstream-commit: f88626b270827da7e8a2d668dc2e16bbe1ac53f0
Component: engine
2017-06-22 10:57:07 -07:00
e48afa3455 Merge pull request #33774 from Microsoft/jjh/lcow-networking
LCOW: owner and network endpoints
Upstream-commit: c85f92de15d8f7162b7579143d2be74d8453996d
Component: engine
2017-06-22 16:40:50 +02:00
45ddb5a6b4 Fix paths for completion scripts
The completion scripts have been moved to the
docker/cli repository, so should be taken from
that directory.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: e1902e55b76203dd8a5b5ff8249ff750ab365b96
Component: packaging
2017-06-22 01:55:38 -07:00
7ccd764533 fix mem leak in libcontainerd/queue/append
Signed-off-by: yangshukui <yangshukui@huawei.com>
Upstream-commit: 5425a5ab842894d7eb7e26bb706a04be40b67075
Component: engine
2017-06-22 16:47:47 +08:00
926eab07b2 Merge pull request #33772 from cpuguy83/optimizations
Don't json marshal then immediately unmarshal
Upstream-commit: 4fc2710dc7a8fc87849e94770fcf33eececae2fc
Component: engine
2017-06-22 01:19:08 -07:00
08990efb47 Merge pull request #226 from mstanleyjones/typo-fix-auth
Fix small typo
Upstream-commit: ae2c3ffb40
Component: cli
2017-06-22 10:01:24 +02:00
ce6099fcd2 Merge pull request #228 from seemethere/wrap_pwd
Fix mounts for directories with weird chars
Upstream-commit: 53ac8bbed8
Component: cli
2017-06-22 09:59:41 +02:00
8aabb3651f Increase the Coverage of pkg/streamformatter
Signed-off-by: Raja Sami <raja.sami@tenpearls.com>
Upstream-commit: 956c5b61cea9e476847b9d2231ac66d3ec85f018
Component: engine
2017-06-22 12:29:10 +05:00
ce27333614 Merge pull request #33776 from thaJeztah/remove-deprecated-mkimage
Remove deprecated contrib/mkimage-xyz scripts
Upstream-commit: 5f0062f0fa97adc480f2e15b20efb89f5cbe3b5b
Component: engine
2017-06-21 22:41:48 -07:00
40224fcf4b LCOW: owner and network endpoints
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: e99a633720563d8d8d2669791cee542c0f989291
Component: engine
2017-06-21 22:35:30 -07:00
02a0e27cd2 Remove deprecated contrib/mkimage-xyz scripts
The contrib/mkimage-busybox.sh, contrib/mkimage-debootstrap.sh,
and  contrib/mkimage-rinse.sh were deprecated in commit
51f707cf9dfb2dbe31cfd0cd92b922ca5d98e842, in favor of
their equivalents in contrib/mkimage/

Given that the deprecation warning has been in place
for over three years, it's save to now remove these.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: d14fb3ac4e712e5927eaad33213b0910aa56ec13
Component: engine
2017-06-21 21:56:24 -07:00
0ae69f3fe0 Merge pull request #33750 from dnephin/cleanup-more-cli-leftovers
Cleanup more cli leftovers
Upstream-commit: 4bdb6ed9b58d641176a601cfe92d496038c5a557
Component: engine
2017-06-21 21:23:28 -07:00
33086f32cd Grab a lock to read container.RemovalInProgress
Signed-off-by: Fabio Kung <fabio.kung@gmail.com>
Upstream-commit: 481a92cb4111ebc1b7d4de5eeff84f570e4ba5dd
Component: engine
2017-06-21 19:11:23 -07:00
9fb14cdd14 Fix mounts for directories with weird chars
Fixes:
`make -f docker.Makefile binary`

When directories have characters like `&&` they must be wrapped in
quotes or else the docker run command will fail.

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 1119e992f2
Component: cli
2017-06-21 17:47:40 -07:00
2182fa2720 Merge pull request #32779 from rremer/auto-update-client
pull client API version negotiation out of the CLI and into the client
Upstream-commit: 8a672ba1aa5534a633b05fec7954afefd00b49f6
Component: engine
2017-06-21 17:35:22 -07:00
ad62bca460 Merge pull request #33241 from Microsoft/jjh/multi-layerstore
LCOW: Support most operations excluding remote filesystem
Upstream-commit: 930e6896685f614d8f15ed10207596b1a151cbc8
Component: engine
2017-06-21 15:45:23 -07:00
61e4b54502 Vendor swarmkit 79381d0
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 79b940feee9cf18893ead7269cfd59ec41bd7297
Component: engine
2017-06-21 15:32:53 -07:00
f9852d6a7a Don't json marshal then immediately unmarshal
During container startup we end up spending a fair amount of time
encoding/decoding json.
This cuts out some of that since we already have the decoded object in
memory.

The old flow looked like:

1. Start container request
2. Create file
3. Encode container spec to json
4. Write to file
5. Close file
6. Open file
7. Read file
8. Decode container spec
9. Close file
10. Send to containerd.

The new flow cuts out steps 6-9 completely, and with it a lot of time
spent in reflect and file IO.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 8d588d9c5b5cd019e09bcfc4f790eae79405c7b1
Component: engine
2017-06-21 15:18:01 -07:00
f7df2b4669 Merge pull request #33735 from tonistiigi/force-pull-fix
builder: fix copy —from conflict with force pull
Upstream-commit: 795a2fdbcb31fdc80ed5bb1fc8bf01e44b1a961d
Component: engine
2017-06-21 12:07:54 -07:00
08cdfb1fb9 Fix small typo
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Upstream-commit: ede69a38c2
Component: cli
2017-06-21 11:06:26 -07:00
c6aa6c7ead Reformat filtering options in ps ref
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Upstream-commit: 0888df3058
Component: cli
2017-06-21 10:31:03 -07:00
4dc3e08e78 Merge pull request #33755 from aaronlehmann/imagestore-locking
image: Improve store locking
Upstream-commit: e64c2d7122158d7d8583ff6967c3e4a833042c25
Component: engine
2017-06-21 10:01:19 -07:00
ebe9d0fb69 Merge pull request #152 from dnephin/improve-volume-parse
Improve volume spec parsing
Upstream-commit: edfc89f4de
Component: cli
2017-06-21 11:45:20 -04:00
bcbca95cb7 Merge pull request #222 from thaJeztah/carry-moby-33290
Explain `stack deploy` with multiple Compose files
Upstream-commit: 4b1055aaa6
Component: cli
2017-06-21 17:36:20 +02:00
3cdf042bf3 Remove yaml docs generator and man pages
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 2b45ec7f786bc91d6db42bd33c13e28a06d30aa3
Component: engine
2017-06-21 11:20:05 -04:00
6dc61813df Remove bindata
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 96e61f3173c21a94f06db2bf1f8a6041da3e4e21
Component: engine
2017-06-21 11:20:05 -04:00
628a1d1381 remove cli concerns from hack/make
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: ea2e4d73c4c753cdc99966e4dfe35143e79564ce
Component: engine
2017-06-21 11:20:05 -04:00
e9c808203d Remove miekg/pkcs11 from vendor.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4e5293c253c4803de75c77cc9cee024d95303d6a
Component: engine
2017-06-21 11:18:44 -04:00
10a4963c2c Remove pkcs11, libltdl-dev, and clang for osx.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b877fc31c51baaf1ec42501ab366dd05a5b6bb21
Component: engine
2017-06-21 11:18:44 -04:00
da0da46764 Merge pull request #33749 from Microsoft/jjh/cross
Show what cross-build is executing
Upstream-commit: be02125491bf0b4556b3f82377ae7ff9b88f336a
Component: engine
2017-06-21 17:17:10 +02:00
2b68a9d068 Use compose volume spec parser for container volume flag
Restore testcases for Volume spec parsing.
And correctly interpret the parsed volume.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 732261f774
Component: cli
2017-06-21 11:16:04 -04:00
49c6d18b80 Some improvements to compose volume spec parsing
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: db6ff357a7
Component: cli
2017-06-21 11:13:52 -04:00
3738ce72e4 Merge pull request #33748 from cpuguy83/remove_osx_cross
Remove OSX cross stuff from main Dockerfile
Upstream-commit: 9823457ed5af653689a3eb59f43960138b5528f3
Component: engine
2017-06-21 14:14:09 +02:00
8903bd3d57 Unmarshal a number as a Number in RawInspectFallback
Running `docker inspect --format "{{.ID}} {{.Size}}" alpine` prints
sha256:651aa95985aa4a17a38ffcf71f598ec461924ca96865facc2c5782ef2d2be07f 3983636
While `docker inspect --format "{{.Id}} {{.Size}}" alpine` prints
sha256:651aa95985aa4a17a38ffcf71f598ec461924ca96865facc2c5782ef2d2be07f 3.983636e+06

This happens because "Id" is not a field of types.ImageInspect and thus
tryRawInspectFallback is called and converts the raw response into `interface{}`
using a JSON decoder. However, by default that decoder converts numbers into
`float64` unless `UseNumber` is set.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 9a2f2d769d
Component: cli
2017-06-21 13:10:14 +03:00
3d78550cb5 Merge pull request #164 from mstanleyjones/clarify-attach
Clarify ability to attach multiple times
Upstream-commit: 9f00ec085f
Component: cli
2017-06-21 10:59:34 +02:00
a375e303b3 Merge pull request #33757 from tonistiigi/update-docker-py
dockerfile: update docker-py
Upstream-commit: 29c0238cac6ecdf2bf81513570c4b5fec1bb5094
Component: engine
2017-06-21 10:23:54 +02:00
be0409b2e0 Merge pull request #196 from dnephin/use-circleci-workflow
Use CircleCI workflows
Upstream-commit: 93562e94a9
Component: cli
2017-06-21 10:06:31 +02:00
3b2ad4db09 Merge pull request #214 from adshmh/add-unit-tests-to-stack-package
add unit tests to stack package
Upstream-commit: d5d0ec56c1
Component: cli
2017-06-21 10:00:08 +02:00
24b6b491fa pull client API version negotiation out of the CLI and into the client
Signed-off-by: Royce Remer <royceremer@gmail.com>
Upstream-commit: 5f1d94e569592fc2680f8661e16d0e5b02e82492
Component: engine
2017-06-20 22:58:16 -07:00
1aa240e6dc dockerfile: update docker-py
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: d183d6fa7d91307eb6ea68582697f3e1e5e5dfcd
Component: engine
2017-06-20 22:03:35 -07:00
878246195d Merge pull request #216 from thaJeztah/fix-markdown
Fix Markdown formatting of experimental "stacks"
Upstream-commit: e07fbfda7e
Component: cli
2017-06-20 21:31:07 -07:00
0e797a650f Explain stack deploy with multiple Compose files
The Docker Compose docs suggest using a separate override
configuration file for production-specific settings, but
it is not obvious how to feed this to `docker stack deploy`,
which only supports a single Compose file as input. Thus,
we now describe how to do this by merging the configuration
files with `docker-compose config`.

Signed-off-by: Denis Washington <denis@denisw.de>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 36fa4af30b
Component: cli
2017-06-20 21:23:21 -07:00
edf13621d4 Fix lint errors merged while new lint branch was in PR.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b84e21cd05
Component: cli
2017-06-21 00:11:59 -04:00
429224cba5 LCOW: Set correct default shell for platform in builder
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: fe7b4d8fcd737b9162540149acc427d51d1ddfb9
Component: engine
2017-06-20 19:54:33 -07:00
c06d3d8d0f Show what cross-build is executing
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: d82e26ae424b421a047aeb0f3c866e8fe49351d8
Component: engine
2017-06-20 19:50:14 -07:00
5115d455e7 LCOW: Rework after 33454 merged which refactored daemon/builder interface
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 3a09b56a10960fb740182d2a12e907f2e80b54c8
Component: engine
2017-06-20 19:50:13 -07:00
2c98e91710 LCOW: Fix schemav1 pull to extract platform
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: b21d9ab5954b77222985fcbd326b1ef7ff7f6d64
Component: engine
2017-06-20 19:50:13 -07:00
420a8c950f LCOW: Coherency - ensure windowsfilter driver is not used
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: bdabc76a5336322de505f8ec7dd3e0959c5919a8
Component: engine
2017-06-20 19:50:13 -07:00
30ae68b1d5 LCOW: Don't mount for linux containers either
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f8aa70055ef59e73f3c52fc028a0ad3c1634e697
Component: engine
2017-06-20 19:50:12 -07:00
01b491fce5 LCOW: Create layer folders with correct ACL
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: ed10ac6ee93cf5c389a735c0c97b08d5d5dff3a9
Component: engine
2017-06-20 19:50:12 -07:00
94ce604e3d LCOW: OCI Spec and Environment for container start
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f1545882264e743fa6d6859ee8687407e28fc35c
Component: engine
2017-06-20 19:50:11 -07:00
3ad2759bd3 Vendor jhowardmsft/opengcs v0.0.3
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 07034a4420c9bd1cb964f18c0128a215ab17d5a8
Component: engine
2017-06-20 19:49:56 -07:00
1a43aff22a Vendor Microsoft/hcsshim @ v0.5.2
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 8fe9eb0551aa02eeacf1a27d5cf5adeb0c2bacac
Component: engine
2017-06-20 19:49:55 -07:00
9541d17c29 LCOW: Plumb through platform on Import
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 3d5cec70b4432866e4c290e9fc601571ca09da9d
Component: engine
2017-06-20 19:49:54 -07:00
6ced3cca3f LCOW: Push to switch platform
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: a97b99e2d801ed1ec4c77387dd7b47631697c25f
Component: engine
2017-06-20 19:49:54 -07:00
eb420d5366 LCOW: Image exporter update
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: e05cedcbf9efcfe864574dea054a71665cf089b6
Component: engine
2017-06-20 19:49:54 -07:00
ebc74326cd LCOW: Fix ImageCache to address right store
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: ba40132366e196c740cdf2d2f1cbee7ead955d2f
Component: engine
2017-06-20 19:49:53 -07:00
30a1a8646e LCOW: Store integrity checks
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 87abf34a3d7bb63e3948eb1d801ac43b379d779e
Component: engine
2017-06-20 19:49:53 -07:00
2665467b29 LCOW: Builder plumbing
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 08252bc963a20b2fb3052fc8db7143771c8c3248
Component: engine
2017-06-20 19:49:53 -07:00
094f300460 LCOW: pull goes to correct stores
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: a1fe1dc791633998bcc82b5f0734a5da68d2bb41
Component: engine
2017-06-20 19:49:52 -07:00
0e82890827 LCOW: commit to use image platform, not host
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 8f5378069444fba89e43b95e95d5ac630b33d90b
Component: engine
2017-06-20 19:49:52 -07:00
3af9801344 LCOW: Move daemon stores to per platform
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 3aa4a0071536d3b106374eaa44d8a55765901aa6
Component: engine
2017-06-20 19:49:52 -07:00
5ce127c469 LCOW: Add platform to image store
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 6c336849876c2117381618b577f1b24f1fb85571
Component: engine
2017-06-20 19:49:51 -07:00
767c3943b7 LCOW: Add platform to container, init on FromDisk()
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f97fbba5cec3d27099e230f7c1dc278c54180d74
Component: engine
2017-06-20 19:49:51 -07:00
97b623b9f6 LCOW: Graphdriver
Signed-off-by: John Howard <jhoward@microsoft.com>

Adds the graphdriver for Linux containers on Windows
Upstream-commit: ed4d2aa981a9057766a9cec53c3bd19be4eef059
Component: engine
2017-06-20 19:49:24 -07:00
8a5a7a8a1e If docker swarm ca is not called with the --rotate flag, the other
flags, including cert expiry, will be ignored, so warn if a user attempts
to use `docker swarm ca --cert-expiry` or something.

Signed-off-by: Ying Li <ying.li@docker.com>
Upstream-commit: 32b43bc21a
Component: cli
2017-06-20 18:55:10 -07:00
60028ea97d image: Improve store locking
This showed up in a recent profile.

Search doesn't need to take a lock on the store, because digestset has
its own locking.

Some other methods can get by with a read lock instead of an exclusive
lock.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 44e67adae5695e3e2c3b450453ab0fe6119eb80d
Component: engine
2017-06-20 18:31:29 -07:00
dee43e0b2b Merge pull request #33694 from shakeme/master
Small fix and new option for contrib/mkimage_alpine.sh
Upstream-commit: 88bddd46d8ff0df7098624554bdc62deb2c84a7a
Component: engine
2017-06-20 17:00:30 -07:00
2dbec80975 Merge pull request #176 from dnephin/new-lint
New linters
Upstream-commit: 2bfac7fcda
Component: cli
2017-06-20 16:47:45 -07:00
c196fc8ae5 Merge pull request #195 from Zebrilee/fix-issue-114
fix the issue `--help` doesn't work if daemon is not available
Upstream-commit: 760f847bc8
Component: cli
2017-06-20 16:38:36 -07:00
9ec73b6716 Specify the make variables, add docker-ce example
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: c57562d148886f1fb892db1e4604eb2399cc7399
Component: packaging
2017-06-20 16:23:43 -07:00
6752b15b06 Merge pull request #93 from dave-tucker/proxyConfig
Allow Proxy Configuration in config.json
Upstream-commit: 6f6ccbd6bc
Component: cli
2017-06-20 16:15:19 -07:00
02b551dece Merge pull request #33587 from bergwolf/aufs
fix aufs mount option length calculation
Upstream-commit: 226bf3e0d92511d20792b1dd1bf72fb3eb67b6a9
Component: engine
2017-06-20 15:51:42 -07:00
d3db128900 builder: fix copy —from conflict with force pull
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: c268d9da4b658b2dd1fe48010a8929b603913e92
Component: engine
2017-06-20 15:45:33 -07:00
8f64a8f93c Fix Markdown formatting of experimental "stacks"
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: c5301ca35d
Component: cli
2017-06-20 15:15:08 -07:00
cc33574a88 bump RPM changelog version to 17.06.0-ce
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 7e955d1f0c8c011058d7291d4c0dd2f0e65e4b8e
Component: packaging
2017-06-20 14:25:27 -07:00
1314e42d84 Adds operating instructions
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: a1a29c1440d5396d2a1be4e933472188554ad61f
Component: packaging
2017-06-20 14:12:18 -07:00
2a96330e2c Merge pull request #33639 from thaJeztah/cleanup-TestServiceCreateCompatiblePlatforms
Make TestServiceCreateCompatiblePlatforms use actual API response
Upstream-commit: c621330ba928c85e8c576b0d89ecbf985f5bdf5c
Component: engine
2017-06-20 13:57:06 -07:00
6220fae10d Merge pull request #33097 from stevvooe/remove-random-pkg
pkg: remove random package
Upstream-commit: b5f68d7ed3a2a9db7bdbfd3bdee42d9d1a7e5423
Component: engine
2017-06-20 13:43:38 -07:00
56c93a237b Show what cross-build is executing
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: cdc39033effc940eda23854d3b5afbf706a8d17a
Component: engine
2017-06-20 13:30:51 -07:00
3814817472 Remove OSX cross stuff from main Dockerfile
This is no longer needed here. It was required for compiling the CLI
which we no longer do here.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 57f0e0c61982269093eb6d9934656ea70b573938
Component: engine
2017-06-20 13:06:37 -07:00
e2861e049e add unit tests to stack package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 535af2d868
Component: cli
2017-06-20 14:31:00 -04:00
7ded95d08c LCOW: Deprecate storagedriver option
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 01e597ca4351b83e32346c32ad510f03b0b3b95b
Component: engine
2017-06-20 09:21:37 -07:00
8508f49b3f LCOW: Pass platform through into layer store
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 42c5c1a9ec14f00d5a5367131493cbd6de7d72b0
Component: engine
2017-06-20 09:21:37 -07:00
04857f417d LCOW: Adds platform to the layer store
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: fc21bf280bac39377d3a236efa87f5c8cbadfb9f
Component: engine
2017-06-20 09:00:32 -07:00
dd6f4eb487 LCOW: Remove CommonContainer - just Container
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 55f8828eec1ff6c70628a0b6f22bea175ce36159
Component: engine
2017-06-20 08:55:46 -07:00
cad0e361c3 LCOW: Add environment variable to enable
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: fe5b34ba8828dc2f2f7db180a102cee360fec6e0
Component: engine
2017-06-20 08:55:46 -07:00
d49d72e7d6 Allow Proxy Configuration in config.json
This commit modifies config.json to allow for any proxies allowed in
build-args to be configured. These values will then be used
by default as build-args in docker build.

Signed-off-by: Dave Tucker <dt@docker.com>
Upstream-commit: 35f1e301b5
Component: cli
2017-06-20 09:51:41 +01:00
8c7c972d20 Merge pull request #33454 from dnephin/refactor-builder-remove-copy-on-build
[Builder] Move file coping from the daemon to the builder
Upstream-commit: 99c72eb2682c0539ad3cc544eb28876af78b33a1
Component: engine
2017-06-20 10:12:57 +02:00
aa2281f8d3 Merge pull request #23 from seemethere/increment_to_rc5
bump Version to 17.06.0-ce-rc5
Upstream-commit: 3f1a023d0c1b474ef82f4c0fd2c2b730bed32281
Component: packaging
2017-06-19 23:42:46 -07:00
7819b28c1f Merge pull request #20 from andrewhsu/restart
restart docker service if needed for rpm upgrade
Upstream-commit: 7267953ecb55a0c0ac73cc04edd68746e725105c
Component: packaging
2017-06-19 23:40:24 -07:00
a189d6d755 restart docker service if needed for rpm upgrade
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: 3152177fdd93d6e3d8c930600bd9bff4f9a36e1d
Component: packaging
2017-06-20 06:33:07 +00:00
077c312216 Merge pull request #33725 from ripcurld0/deprecate_go16
Remove Go 1.6 code from moby
Upstream-commit: 93c06b801334713f88e92838f67cf322e6eb808b
Component: engine
2017-06-20 08:54:01 +03:00
125062e5cf Add note to CopyToContainer documentation
Signed-off-by: Brian Schwind <brianmschwind@gmail.com>
Upstream-commit: 1c3071e487db96ba8274ac2388eca0002e9cee77
Component: engine
2017-06-20 14:49:38 +09:00
06b45c7fcc Merge pull request #24 from andrewhsu/conflict
also have deb pkg conflict docker-engine
Upstream-commit: 405d7d99610ff686a7c24ec0ce404d7e45fa6795
Component: packaging
2017-06-19 21:05:16 -07:00
1a754b3d95 also have deb pkg conflict docker-engine
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: f7ad018c91316588a756e4e97cd48c246b2c1419
Component: packaging
2017-06-20 03:55:08 +00:00
ea569af511 Libnetwork vendoring
Fixes in the Service Discovery areas

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
Upstream-commit: e1953f1ca717c2609a0ee801c8af5b874d9fc3d2
Component: engine
2017-06-19 19:42:24 -07:00
4b4c229f4e Prefixes documentation files per component (#21)
* Prefixes documentation files per component

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>

* Remove reliance on basename

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 24e443c109ae5e133f1b20e6c4f9a17126767c71
Component: packaging
2017-06-19 18:29:22 -07:00
0badb5dd2c bump Version to 17.06.-ce-rc5
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: d9b0a3c4106bd9edb38c38f968fab47409c8eeb1
Component: packaging
2017-06-19 18:25:00 -07:00
77f12eb0fe Merge pull request #18 from cpuguy83/conflicts_docker_ee
Add conflicts with docker-ee
Upstream-commit: c5ed65456c22e4ea514eb730ed25378669a3c6f4
Component: packaging
2017-06-19 14:16:55 -07:00
0a8fc1d6f6 Merge pull request #33522 from naveed-jamil-tenpearls/pkg/promise
Added Test Case Coverage for PKG/PROMISE
Upstream-commit: 16380b3ee68c0da2fda036d7980129241957220c
Component: engine
2017-06-19 13:53:42 -07:00
51efe95e2e Merge pull request #33732 from nhorman/cookie-clean-up
devmapper: ensure that UdevWait is called after calls to setCookie
Upstream-commit: 7e3d0a54a136f66f85633a3ffa25004ecf7d19bf
Component: engine
2017-06-19 13:26:02 -07:00
37ac27cec4 devmapper: ensure that UdevWait is called after calls to setCookie
Recent changes to devmapper broke the implicit requirement that UdevWait be
called after every call to task.setCookie.  Failure to do so results in leaks of
semaphores in the LVM code, eventually leading to semaphore exhaustion.
Previously this was handled by calling UdevWait in a ubiquitous defer function.
While there was initially some concern with deferring the UdevWait function
would cause some amount of race possibiliy, the fact that we never return the
cookie value or any value used to find it, makes that possibility seem unlikely,
so lets go back to that method

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Upstream-commit: 23dcfec1404411489e23fb9b76fc7096db139d04
Component: engine
2017-06-19 13:50:57 -04:00
aae660696a Merge pull request #33695 from cpuguy83/volumes_check_ownership
Don't chown/chmod volumes if not needed.
Upstream-commit: 630b9a45d2537a21fa5ba3249a3c780d2b6a00fc
Component: engine
2017-06-19 06:31:58 -07:00
c832750e54 Remove Go 1.6 code from moby
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 6bfd0f6b5d08bcd609da11947432ad0f3aa3d8fd
Component: engine
2017-06-19 15:59:00 +03:00
43cd078fda Merge pull request #33727 from rremer/test-cleanup-daemon-logger
cleanup daemon/logger/adapter_test.go
Upstream-commit: f0024808a1844cc5004461f40c5d840a48e14d48
Component: engine
2017-06-19 05:56:43 -07:00
0e43fa4b98 * standardize timeouts for log reads and writes for logger adapter tests
* use an assertion framework in logger adapter tests

Signed-off-by: Royce Remer <royceremer@gmail.com>
Upstream-commit: b3add005d5135f64670f6502357cde5bd8d03f75
Component: engine
2017-06-18 18:47:45 -07:00
0db82d1f6c Don't chown/chmod volumes if not needed.
Doing a chown/chmod automatically can cause `EPERM` in some cases (e.g.
with an NFS mount). Currently Docker will always call chown+chmod on a
volume path unless `:nocopy` is passed in, but we don't need to make
these calls if the perms and ownership already match and potentially
avoid an uneccessary `EPERM`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: f05a023760493dbd41fbfc1bb76ad334b579e94e
Component: engine
2017-06-18 16:44:52 -07:00
f162d46aa3 Add conflicts with docker-ee
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 1c0fdb57a4c7d485f301050e140ad57bdf231cde
Component: packaging
2017-06-18 15:24:56 -07:00
8f272dd02c Merge pull request #33403 from szegedim/33126-whitelist-adjtimex
Whitelisting adjtimex get time operation and requiring CAP_SYS_TIME only in case of adjustment
Upstream-commit: 4f259698b07653e9e5220e097df79862f9e54b74
Component: engine
2017-06-16 21:30:35 -07:00
bfbdad0a36 Merge pull request #17 from cpuguy83/obsolete_docker-selinux_pkg
Mark docker-*-selinux pkgs as obsolete
Upstream-commit: 43edc2d7fee731d0cac7b221266b9bd8e5cd5377
Component: packaging
2017-06-16 15:44:12 -07:00
6f4d8ba43b Merge pull request #124 from darrenstahlmsft/revendorGowinio
Update go-winio to v0.4.1
Upstream-commit: 5dd30732a2
Component: cli
2017-06-16 15:21:55 -07:00
a438006e4f Mark docker-*-selinux pkgs as obsolete
These are replaced by `container-selinux` on fedora-25 and centos-7.
Marking these packages as obsolete makes the installation process a bit
smoother, otherwise the user will have to manually uninstall the older
packages to install the new one.

Also makes fedora24 use container-selinux which is now supports labeling
the `dockerd` binary correctly.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 94943b47520aa81bbe30fbc4eb927c79047ef6d2
Component: packaging
2017-06-16 17:27:51 -04:00
a93d31683c Merge pull request #199 from adshmh/remove-logging-from-command-formatter-package-tests
removed logging from command/formatter package tests
Upstream-commit: f767b9a118
Component: cli
2017-06-16 14:08:39 -04:00
3703860d4e Merge pull request #33517 from naveed-jamil-tenpearls/pkg/reexec
Added Test Case Coverage for PKG/REEXEC
Upstream-commit: acf23c736724c861236d8b5cbee339c812fe9d7f
Component: engine
2017-06-16 15:24:51 +02:00
01abe5df95 Merge pull request #33712 from cyli/redact-ca-signing-cert
Redact swarm spec CA signing cert for usability reasons
Upstream-commit: 0919a1da149705f1ba50610346cea6f14574dd10
Component: engine
2017-06-16 09:21:59 -04:00
4b515641e8 Merge pull request #32547 from allencloud/make-ulimitOpt-implement-NamedOption
add NamedUlimitOpt to implement NamedOption to fix 32528
Upstream-commit: a6911bf8cc58195bced536b9e3f2b94edf2b5c15
Component: engine
2017-06-16 11:27:01 +02:00
5a0cf39b76 Merge pull request #33705 from tonistiigi/fix-cobra-vendor
vendor: remove unused package
Upstream-commit: cc73511764227fc3d229cd05adbf01abee593dcf
Component: engine
2017-06-16 10:35:50 +02:00
9fa6954b47 comment the return of setHelpFunc in order to show --help even if the daemon is not running. Then add a if statement in isSupported function to check if the daemon is running
Signed-off-by: zebrilee <zebrilee@gmail.com>

revert change on docker.go, set HasExperimental to true in cli.go

Signed-off-by: zebrilee <zebrilee@gmail.com>
Upstream-commit: cca30cb1d9
Component: cli
2017-06-16 10:24:26 +02:00
ead60478b8 add NamedUlimitOpt implement NamedOption to fix 32528
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 148f2711e8e78c9cf43b4c30b03b33b16d9e7098
Component: engine
2017-06-16 10:14:09 +08:00
d01b45b0ff Redact the swarm's spec's signing CA cert when getting swarm info, because
otherwise if the user gets the info from the API, makes a non-CA related change,
then updates, swarm will interpret this as the user trying to remove the signing
key from the swarm.  We are redacting due to usability reasons, not because
the signing cert is secret.  The signing KEY is secret, hence it's redacted.

Signed-off-by: Ying Li <ying.li@docker.com>
Upstream-commit: bdfbd22afbbf16a07f0316656c6c17453df3e0f7
Component: engine
2017-06-15 18:26:01 -07:00
a014e4af05 Merge pull request #33498 from darrenstahlmsft/IoTDataPartition
Skip evaluation of symlinks to data root on IoT Core
Upstream-commit: b931c35a46bd7606fca5bea0b80dc82c1ed7e0d5
Component: engine
2017-06-15 15:52:01 -07:00
7d5222b592 vendor: remove unused package
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 932759c288ef3055919388bc0319cddde0bee34a
Component: engine
2017-06-15 13:23:11 -07:00
ad6108e6a5 Try out circleci workflow
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 75aebdd463
Component: cli
2017-06-15 12:38:40 -07:00
3f1fb4c18f removed logging from command/formatter package tests
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 7f71d0d979
Component: cli
2017-06-15 14:14:59 -04:00
c6249de16a Enable dm deferred_* with version check
This enables deferred device deletion/removal by default if the driver
version in the kernel is new enough to support the feature.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 0dc1a80565d522fc2cc7c65c3ad2d8ed83aeaf0f
Component: engine
2017-06-15 13:13:42 -04:00
1aa1877000 Merge pull request #198 from thaJeztah/add-exec-example
Added usage example for -e for exec
Upstream-commit: eb7452cf3a
Component: cli
2017-06-15 18:18:48 +02:00
a19bc856f6 Merge pull request #33585 from moypray/containerd_core
When daemon is in startup process, could not start container
Upstream-commit: 5eca8382b03278dc42c228b3d14dec0909ce655b
Component: engine
2017-06-15 09:13:41 -07:00
246d4ea4ff Merge pull request #194 from dnephin/run-docs-gen-in-ci
Run docs and man generation in CI
Upstream-commit: 23a0e3b7b7
Component: cli
2017-06-15 17:46:56 +02:00
cd9e55249f Added usage example for -e for exec
Signed-off-by: Vishnu Narayanan <iamwishnu@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: c848d9b22d
Component: cli
2017-06-15 17:24:41 +02:00
01e1289926 Add option for architecture to mkimage-alpine.sh
Signed-off-by: Robert Schneider <mail@shakeme.info>
Upstream-commit: 23f0c20b021849283fb422fab735d893c1946f46
Component: engine
2017-06-15 15:52:25 +02:00
6cc2ed537e Fix getopts in mkimage-alpine.sh
Signed-off-by: Robert Schneider <mail@shakeme.info>
Upstream-commit: a89d282dbb9eefe043a7a2dcfb146b11ade720d1
Component: engine
2017-06-15 15:51:56 +02:00
806904f4de Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-06-15 09:36:47 +00:00
d2f94fb172 Merge pull request #16 from andrewhsu/cl
update rpm changelog
Upstream-commit: c79e2cae2efab60df0fcb2ad272da94f1b629c30
Component: packaging
2017-06-15 02:28:14 -07:00
801070c998 update rpm changelog
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: 659d6015b6bf8ec3c24cf5377f3eda88beed0a10
Component: packaging
2017-06-15 09:15:43 +00:00
774e4b45e3 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-06-15 08:06:01 +00:00
4634634053 Merge pull request #13 from seemethere/add_systemd_files
Add systemd scripts
Upstream-commit: 9c1135df05c6ae371da5879d8a1be88749a2bfbd
Component: packaging
2017-06-15 01:02:43 -07:00
6c8b2e5bbf Use a fork of gometalinter
Until https://github.com/alecthomas/gometalinter/pull/289 is merged.
This reduces the runtime of the linter by 50x

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4881ef507f
Component: cli
2017-06-14 17:30:45 -07:00
b88ae58881 Add gosimple lint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3724fb7f37
Component: cli
2017-06-14 16:55:08 -07:00
003a07af7c Add unparam linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3e3934c19f
Component: cli
2017-06-14 16:55:08 -07:00
c9b100a0be Add unconvert linter
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3bf0317fea
Component: cli
2017-06-14 16:54:27 -07:00
16de65eef4 Add misspell lint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a712993e93
Component: cli
2017-06-14 16:54:27 -07:00
2cdc30d891 Add unused linter.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 01e1e58ada
Component: cli
2017-06-14 16:54:27 -07:00
f816b75526 Merge pull request #33302 from cpuguy83/fix_logs_racey_test_win
Make TestLogsAPIStdout a bit less racey
Upstream-commit: 6d92b0ee15cff0d5fade6533f696c7bc9f314021
Component: engine
2017-06-14 16:35:22 -07:00
1bcf02da4f Run docs and man generation in CI
Also cleanup the scripts a bit to be more consistent, and fail on errors.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 343d836a95
Component: cli
2017-06-14 14:59:48 -07:00
440a9de896 Merge pull request #33680 from glensc/patch-1
doc: Update 2017-06-12.md
Upstream-commit: e5679f0bffa860f735b2db4309cc72b8871a96b5
Component: engine
2017-06-14 23:11:23 +02:00
cfd4f5c94e Merge pull request #33361 from aaronlehmann/no-join-address
cluster: Only pass a join address when in the process of joining a cluster
Upstream-commit: c86323c19d77e94c280fec9fc78480939d176d1b
Component: engine
2017-06-14 14:08:37 -07:00
4b4286a493 Update 2017-06-12.md
Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
Upstream-commit: 35e15c5c04174ee4bd71ae9ad226e996afa9b41d
Component: engine
2017-06-14 23:16:22 +03:00
7b49eaf104 Merge pull request #191 from php-coder/improve_user_directive_doc
docs/reference/builder.md: mention that USER directive also allows to specify a user group
Upstream-commit: 4c224a7786
Component: cli
2017-06-14 22:03:38 +02:00
604510bf2e Merge pull request #182 from vdemeester/180-fix-stack-rm-config-endpoint
Do not call the config endpoint if API is lower than 1.30
Upstream-commit: 759e59e4a4
Component: cli
2017-06-14 14:31:01 -04:00
d2ab6e1508 Merge pull request #193 from dnephin/why-cover-so-slow
Speed up testing with coverage
Upstream-commit: 45c2c4c18f
Component: cli
2017-06-14 11:29:42 -07:00
b937aa98bc Merge pull request #192 from adshmh/remove-logging-from-service-inspect-test
remove logging from service/inspect test case to clean up the output of running tests
Upstream-commit: 63eff6548b
Component: cli
2017-06-14 14:23:40 -04:00
6ca362a6db Speed up testing with coverage
By running a 'go test -i' on all the packages first the overall runtime is significantly
decreased.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3a9ba545bc
Component: cli
2017-06-14 10:57:36 -07:00
3c78860ecb Merge pull request #33637 from thaJeztah/improve-ci-build-time
Minor refactor/cleanup of tests
Upstream-commit: 7fdc2e42d1d8eadf38976c3363b994040ad28fa5
Component: engine
2017-06-14 19:45:48 +02:00
9a1729bb2b removed logging from service/inspect test to clean up the output of running tests
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 751278abe6
Component: cli
2017-06-14 12:38:31 -04:00
cd16e5cc8b docs/reference/builder.md: mention that USER directive also allows to specify the user group.
Signed-off-by: Slava Semushin <semushin@redhat.com>
Upstream-commit: a84463d8d5
Component: cli
2017-06-14 15:49:37 +02:00
26df7d0bfd Merge pull request #33640 from dsheets/pluginv2-static-start-but-disabled-error
plugin/store.Get: return a specific error if plugin is disabled
Upstream-commit: 397a57d3a5f057a3c787afa107964b692ec2ebe1
Component: engine
2017-06-14 15:35:26 +02:00
4e0a36e808 Merge pull request #33053 from simonferquel/ignore-private-networks
Ignore HNS networks with type `Private`
Upstream-commit: 0c2f3bcd822b798de806be825fd65bbe36d66bd8
Component: engine
2017-06-14 14:20:39 +02:00
18477cd2ed When daemon is in startup process, could not start container
Description:
 When docker is in startup process and containerd sends an "process exit" event to docker.
 If the container config '--restart=always', restartmanager will start this container very soon.

 But some initialization is not done, e.g. `daemon.netController`,when visit, docker would panic.

Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
Upstream-commit: 5b0993d6c778c18735692560538c790faa3dbbb4
Component: engine
2017-06-14 18:53:18 +08:00
75f90c1a7c Merge pull request #33655 from dsheets/authz-disable-race
Eliminate authz plugin disable race
Upstream-commit: 11293d91f94418a454006ee93e88aed1861fcf27
Component: engine
2017-06-14 11:07:23 +02:00
1319ac06c7 Merge pull request #187 from dnephin/small-cleanup-to-image-remove
Fix some problems with image force remove
Upstream-commit: d209929aab
Component: cli
2017-06-14 09:59:32 +02:00
544efe0207 Merge pull request #115 from jsoref/spelling
Spelling
Upstream-commit: 4ffefe4a1f
Component: cli
2017-06-14 09:58:55 +02:00
f3827b078b Do not call the config endpoint if API is lower than 1.30
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 2128b3f112
Component: cli
2017-06-14 09:56:53 +02:00
9f19cc9a66 Merge pull request #33663 from vieux/report-2017-06-12
Moby Dev Report 2017 06 12
Upstream-commit: 7959c2e49d0f999c0d44e00febdbf390c0d3a944
Component: engine
2017-06-13 23:05:57 -05:00
86f07ae89f Merge pull request #33665 from tiborvass/remove-docs
Remove docs (except docs/api), experimental/, contrib/completion, man/
Upstream-commit: 6d556df196d8dcf78e72e8bf0486f3f5156cfd73
Component: engine
2017-06-13 23:04:25 -05:00
0f674e20a2 Merge pull request #189 from tiborvass/update-docs
Update docs, completion, man
Upstream-commit: 3be666387a
Component: cli
2017-06-13 23:04:09 -05:00
42c5a6e86e Remove docs (except docs/api), experimental/, contrib/completion, man/
They have been moved to github.com/docker/cli.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: b5579a4ce33af4c1f67118e11b5a01008a36d26a
Component: engine
2017-06-14 03:14:46 +00:00
2f5b714872 Update docs, completion scripts for disable-legacy-registry
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2b8f0eef7338f37104464154ba65aef7db3b9703)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: ee1bbab620
Component: cli
2017-06-14 02:48:46 +00:00
786d489f99 Merge pull request #33572 from hsluoyz/patch-1
Add Casbin plugin to the list of Authorization plugins in docs.
(cherry picked from commit 220831d541bfe9bf566c1038773198d431560dd3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 0ad3e3294e74f443130b5e1fb1ef6b31f4f92366)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 8b11d46ecd
Component: cli
2017-06-14 02:48:46 +00:00
9a66d3e2b0 Merge pull request #32804 from bbodenmiller/patch-1
remove extra word
(cherry picked from commit 9db03bd8cdad3c8804105cb5794ebad5e728f48f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3eaec0071c3ce1b7201e37859afe5bcb78d4f215)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: ba4dcadcaa
Component: cli
2017-06-14 02:48:46 +00:00
090c6ccf05 Merge pull request #32791 from djalal/patch-1
fix typo
(cherry picked from commit 32a52716b964373b4ac464052e73ea5da79856c6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit fcbd93f52032593cc71b298c00a46fd354356650)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 8247a36058
Component: cli
2017-06-14 02:48:46 +00:00
13d31e4cd8 Merge pull request #32735 from bhavin192/patch-1
Add note about host-dir in VOLUME
(cherry picked from commit f2fff9d913a8ab0436dd56033189a7c3713a59a2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8fd6547fc3eb67e7efa7efb007ae6a4494cd2bb3)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 5bf86c1984
Component: cli
2017-06-14 02:48:46 +00:00
fc9f540d08 Merge pull request #32724 from PatrickLang/patricklang-win-memory
Adding more on -m and --memory
(cherry picked from commit c3fbca106552f2dadcb89510ff87945b50f36419)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit b4047a849bd3018f8a8eabf34613a4fca57f818e)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: b1738f4505
Component: cli
2017-06-14 02:48:46 +00:00
a08039c09b Merge pull request #32684 from scjane/patch-3
Update builder.md
(cherry picked from commit 831066337743fc29ff122fce51afe44b8b3b3ba9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit bc66821abbcf50c721ce9b8f52b339fda102d389)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 7955683eb2
Component: cli
2017-06-14 02:48:46 +00:00
d17a741bef Update deprecated.md for removal of --email flag
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 43239f62bedc4721d27744d21c122622988bb3ae)
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: 6ee8cf85c5
Component: cli
2017-06-14 02:48:46 +00:00
ce3a475d7a Moby June 12th dev report
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: b9dfa9ab753c6239905b4cc506d84dba458800a1
Component: engine
2017-06-13 19:02:26 -07:00
1b032e855d Skip evaluation of symlinks to data root on IoT Core
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 8e71b1e210dc0eff980f39271d6c1dd48d87024e
Component: engine
2017-06-13 15:02:35 -07:00
774e3b7a1d Merge pull request #72 from thaJeztah/fix-prefix-matching
Fix prefix-matching for service ps
Upstream-commit: 275c488734
Component: cli
2017-06-13 14:59:37 -07:00
809225a7dc Merge pull request #184 from yongtang/167-network-inspect-scope
Use scope=swarm for service related network inspect and revendor docker/docker
Upstream-commit: 25bc9f1ce7
Component: cli
2017-06-13 14:47:20 -07:00
a55a518566 Use scope=swarm for service related network inspect.
This fix use `scope=swarm` for service related network inspect.
The purpose is that, in case multiple networks with the same
name exist in different scopes, it is still possible to obtain
the network for services.

This fix is related to moby/moby#33630 and docker/cli#167

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 657457ee2c
Component: cli
2017-06-13 20:26:12 +00:00
8af6b6b3cd Fix some problems with image remove force.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 676b71eaaa
Component: cli
2017-06-13 12:12:54 -07:00
65df45f31c Merge pull request #186 from adshmh/fix-output-leak-from-config-remove-test-case
fix the output leak from error test case for config/remove
Upstream-commit: 7baaa90481
Component: cli
2017-06-13 21:04:47 +02:00
d6e9a073bf Merge pull request #33518 from naveed-jamil-tenpearls/pkg/sysinfo
Increased Unit Test Coverage for PKG/SYSINFO
Upstream-commit: 9c446a4d0061014390e938d01941aab976c38d11
Component: engine
2017-06-13 10:57:49 -07:00
45b64dbaab fixed the output leak from error test case for config/remove
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 006b9b126d
Component: cli
2017-06-13 12:24:42 -04:00
142f748495 authz: remove and hide unused and local-only methods respectively
Signed-off-by: David Sheets <dsheets@docker.com>
Upstream-commit: 24264697c54843ea8dbd30ac37652409943e7bf4
Component: engine
2017-06-13 13:51:11 +01:00
8857822260 authz: eliminate race during plugin removal from middleware
Also, this removes the use of a questionable golang range feature which
corrects for mutation of a slice during iteration over that slice. This
makes the filter operation easier to read and reason about.

Signed-off-by: David Sheets <dsheets@docker.com>
Upstream-commit: 7da3986297e04b419ce08b19766633dba36b7d30
Component: engine
2017-06-13 13:51:07 +01:00
c03bd3f5e9 Merge pull request #32468 from coolljt0725/clean_thin
devicemapper: remove thin pool if 'initDevmapper' failed
Upstream-commit: bccebdac1806d39848c6b51e9fea757e77bc2dad
Component: engine
2017-06-13 07:34:15 -05:00
da632307b9 Make TestServiceCreateCompatiblePlatforms use actual API response
The `TestServiceCreateCompatiblePlatforms()` test was confusing, because it
did not actually use the mocked API response, but used a local
`distributionInspectBody` variable to verify that the `/distribution/` endpoint
was called.

This flow was especially confusing, because a comment in the test describes;

    "check if the /distribution endpoint returned correct output"

If (for whatever reason), the endpoint was not called, the test would panic,
because the `distributionInspectBody` would not be set.

This patch rewrites the test to use the actual API response that is returned
by the mock, and verifies that the information returned by the `/distribution/`
endpoint is properly used in the service's definition.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: f3fce00ef3f3b7ead5ac211f9aafabfebf820c2f
Component: engine
2017-06-13 14:25:50 +02:00
9a1d721392 Merge pull request #185 from vdemeester/fix-image-remove-tests
Fix remove_test output duplication
Upstream-commit: feeeb2c550
Component: cli
2017-06-13 14:21:32 +02:00
25eae686e2 Merge pull request #33621 from thaJeztah/fix-runc-version-exec
Fix missing "--version" argument
Upstream-commit: 5052986afc43788ce96604ea5aa2e441a11b1a89
Component: engine
2017-06-13 14:18:17 +02:00
59b1e60ea5 Fix remove_test output duplication
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: dd924ebf4f
Component: cli
2017-06-13 14:02:56 +02:00
f30d636fb1 Merge pull request #160 from e11137/master
fixes #46 Always exit 0 when remove image with force option
Upstream-commit: ecc8e0a204
Component: cli
2017-06-13 14:02:02 +02:00
a10bff4186 Merge pull request #32088 from simonferquel/windows-dockerignore-fix
Fix behavior of absolute paths in .dockerignore
Upstream-commit: c21c17c64260f474824d9591a4c026a7a01e66e5
Component: engine
2017-06-13 13:36:39 +02:00
b7238aa6a5 Ignore HNS networks with type Private
Fix #33052 (workaround style)

**- What I did**

HNS reports networks that don't have anything to do with the Daemon, and
for which no networking plugin is available. This make the Daemon start
sequence pause for 15 secs, as the plugin resolving logic has a wait &
retry logic

**- How I did it**

Just after retrieving the HNS networks, I filter out those with type
`Private`

**- How to verify it**

Replace dockerd coming with Docker for Windows from one built from this
PR. Windows containers daemon should now launch pretty quickly

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
Upstream-commit: b91fd26bb57c94a7ea7f77e5e548233506b78d21
Component: engine
2017-06-13 13:25:00 +02:00
101aa410f3 Added Test Case Coverage for PKG/PROMISE
Signed-off-by: Naveed Jamil <naveed.jamil@tenpearls.com>
Upstream-commit: cffa6d52a2819c126517333b8b31337ded5cc0d9
Component: engine
2017-06-13 15:17:40 +05:00
7195930562 Merge pull request #33645 from thaJeztah/disable-auto-milestone
Disable auto-assigning PR's to milestones
Upstream-commit: e22656bf2d855157f91cc7391f963b19c9e4aec0
Component: engine
2017-06-13 11:13:08 +02:00
88669e2de2 Merge pull request #33571 from thaJeztah/client-api-version-checks
Add API version checks to client
Upstream-commit: ae487e543c2916bec05dc01ebd364a9d3b88595d
Component: engine
2017-06-13 10:50:05 +02:00
04d4acede5 Update docker/docker to 4310f7da7e6bcd8185bf05e032f9b7321cfa6ea2
This fix updates docker/docker to 4310f7da7e6bcd8185bf05e032f9b7321cfa6ea2

This fix is related to moby/moby#33630 and docker/cli#167

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 8c2f81892b
Component: cli
2017-06-13 02:53:25 +00:00
2a61337b11 Add builder dev report for 2017-06-12
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 810015c5ff04fae45b12bb0a61709aaa4e7f7e41
Component: engine
2017-06-12 19:07:06 -07:00
e90e6dfee2 Disable auto-assigning PR's to milestones
Moby and Docker are separate projects, so
don't assign docker milestones to pull requests
in this repository.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: e481509c746bb53c93b11c349f42ed2549ab728c
Component: engine
2017-06-13 03:32:48 +02:00
b687d7ca5a Merge pull request #33630 from yongtang/167-cli-network-inspect-scope
Add `scope` filter in `GET /networks/(id or name)`
Upstream-commit: 4310f7da7e6bcd8185bf05e032f9b7321cfa6ea2
Component: engine
2017-06-12 18:27:24 -07:00
4356e0cf8e Merge pull request #33374 from raja-sami-10p/pkg/plugins
Increase the Coverage of pkg/plugins
Upstream-commit: 8183b9d12c786b4f7a844d0966df7acb1e78ff1d
Component: engine
2017-06-13 02:50:54 +02:00
0163e7d47c Merge pull request #33642 from aaronlehmann/vendor-swarmkit-a4bf013
Vendor swarmkit a4bf013
Upstream-commit: 3029e4b73c6d271098334daabd8272bdb14acf1b
Component: engine
2017-06-12 17:41:31 -07:00
10e0cc84e6 Merge pull request #157 from dnephin/make-compose-check-fail
Fix check-git-diff in CI
Upstream-commit: 8545341709
Component: cli
2017-06-12 17:15:35 -07:00
f0d519137d Merge pull request #33638 from coolljt0725/mnt_deatch
Use lazy umount on Put for overlay2 and overlay
Upstream-commit: ff2127968dd77be6a0d5d36e28a3ef465a143e15
Component: engine
2017-06-12 18:58:55 -05:00
2ef8445394 Merge pull request #33005 from alfred-landrum/denied-error
Suggest login on pull denial
Upstream-commit: f4bf61c79da153c039e2df586737cd8d54d26a55
Component: engine
2017-06-13 01:51:18 +02:00
2621eb6511 Merge pull request #33414 from darrenstahlmsft/IoTServerContainers
Check for Windows 10 IoT Core to use process isolation on IoT
Upstream-commit: 2ae085f3092325e15c76cf4b24e9d5f2bc400d59
Component: engine
2017-06-12 18:02:15 -05:00
01267bd230 Simplify DockerRegistrySuite.TestUserAgentPassThrough()
This patch simplifies the test by;

- re-using the registry-mock / handler
- skipping the last `docker build`, which was only
  used to make sure a local image was present. Instead,
  the daemon is started with a `busybox` image loaded.

Also added a comment, explaining why the mock always
returns a 404 (hence, error/output-string should not
be checked in the test), and made the mock return a
valid/correctly formatted error response.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 5d04fe73bf9fa7cff1b99206f39536aed807efb3
Component: engine
2017-06-12 20:18:03 +02:00
f3ddace468 Use tempdir instead of working directory as build-context
The `makefile()` utility was used to create a temporary Dockerfile, and after
tests completed, this file was deleted.

However, the _build_ used the current path (`/usr/local/bin/docker`) as
build-context. As a result, roughtly 20 MB was sent as build-context for each
build, but none of the builds actually required a build-context.

This patch;

- creates a temp-dir for the test, which can be used as build-context
- changes the `makefile()` utility and removes the `cleanup` functionality
- instead, the `temp-dir` is removed after the test finishes (which also removes the temporary `Dockerfile`)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: ebe66b1d0f52dc58a98a428d4efa4d2f2743b96e
Component: engine
2017-06-12 20:14:48 +02:00
cf6ccaef8c Merge pull request #33472 from unclejack/use_buffer_io_copy
container/stream/attach: use pools.Copy
Upstream-commit: ac587c40cae89b71ed40c7bb5921d076da0dc44e
Component: engine
2017-06-12 11:14:45 -07:00
299f2dd4fe Merge pull request #33608 from thaJeztah/backport-29083
"back port" #29083
Upstream-commit: dd790d0e37df618bf8d9c204c29947f70c2e6045
Component: engine
2017-06-12 19:54:37 +02:00
f104371302 Vendor swarmkit a4bf013
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 32d7b0f3601258edf94ecf0e2e9018a406846888
Component: engine
2017-06-12 10:31:11 -07:00
aab0327316 Merge pull request #33629 from thaJeztah/disable-v1-registry-by-default
Disable legacy (v1) registries by default
Upstream-commit: df330137207a2895ed324cad9b2a5a3d17793667
Component: engine
2017-06-12 13:11:34 -04:00
234706e29f plugin/store: fix ErrAmbiguous docstring
Signed-off-by: David Sheets <dsheets@docker.com>
Upstream-commit: 2b79dfc240307ab948e0341f7668a3cdfdebf033
Component: engine
2017-06-12 18:07:42 +01:00
cc2f783975 plugin/store.Get: return a specific error if plugin is disabled
Previously, a 'plugin not found' error would be returned if a plugin to be
retrieved was found but disabled. This was misleading and incorrect. Now,
a new error plugin.ErrDisabled is returned in this case. This makes the
error message when trying to statically start plugins (from daemon.json or
dockerd command line) accurate.

Signed-off-by: David Sheets <dsheets@docker.com>
Upstream-commit: e33d598059d8af8c57995a2c52f1f9f5691c09e8
Component: engine
2017-06-12 18:06:00 +01:00
99aad7f08b Add scope filter in /networks/<id>
This fix tries to add a `scope` in the query of `/networks/<id>`
(`NetworkInspect`) so that in case of duplicate network names,
it is possible to locate the network ID based on the network
scope (`local`, 'swarm', or `global`).

Multiple networks might exist in different scopes, which is a legitimate case.
For example, a network name `foo` might exists locally and in swarm network.

However, before this PR it was not possible to query a network name `foo`
in a specific scope like swarm.

This fix fixes the issue by allowing a `scope` query in `/networks/<id>`.

Additional test cases have been added to unit tests and integration tests.

This fix is related to docker/cli#167, moby/moby#30897, moby/moby#33561, moby/moby#30242

This fix fixes docker/cli#167

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 158b2a1875cf33f3560dedaeb0149e1fbe54c1ef
Component: engine
2017-06-12 09:54:25 -07:00
f0223641e1 Merge pull request #33634 from mavenugo/sdh
Vendoring libnetwork f4a15a0890383619ad797b3bd2481cc6f46a978d
Upstream-commit: c23d76b29b9062371c5472eacef3587e4aad3ea5
Component: engine
2017-06-12 09:30:58 -07:00
e3c9f3fa6c Merge pull request #33620 from cpuguy83/skip_size_on_mounted_local_volumes
Do not calculate size for local volumes with mount
Upstream-commit: 135bd20585d869fc2f169e6b1ed6c409d8a56fbd
Component: engine
2017-06-12 11:40:55 -04:00
3c89f979b9 Merge pull request #33636 from thaJeztah/remove-ci-for-email-flag
Remove "-e" / "--email" from integration tests
Upstream-commit: 0314d4f8286e53d8da94a1688c66e5316d7ad775
Component: engine
2017-06-12 16:19:30 +02:00
ad022709e6 Use lazy umount on Put for overlay2 and overlay
we see a lot of
```
level=debug msg="Failed to unmount a03b1bb6f569421857e5407d73d89451f92724674caa56bfc2170de7e585a00b-init overlay: device or resource busy"
```
in daemon logs and there is a lot of mountpoint leftover.
This cause failed to remove container.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: f65fa1f115df896b2440f50c374f032fc781188d
Component: engine
2017-06-12 09:07:25 -04:00
e253cdd33c Remove "-e" / "--email" from integration tests
This option is no longer supported in docker 17.06,
so should not be used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: a7672b8331b1b96db6390a9356650e67893fbe36
Component: engine
2017-06-12 13:32:47 +02:00
cf3b267129 Update docs, completion scripts for disable-legacy-registry
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 2b8f0eef7338f37104464154ba65aef7db3b9703
Component: engine
2017-06-12 11:04:37 +02:00
af2183c2c4 Disable legacy (v1) registries by default
Deprecation of interacting with v1 registries was
started in docker 1.8.3, which added a `--disable-legacy-registry`
flag.

This option was anounced to be the default starting
with docker 17.06, and v1 registries completely
removed in docker 17.12.

This patch updates the default, and disables
interaction with v1 registres by default.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 128280013f2ad90520c97b47a787be0db883e870
Component: engine
2017-06-12 11:04:28 +02:00
3f80d858fd Vendoring libnetwork f4a15a0890383619ad797b3bd2481cc6f46a978d
Contains Service Discovery hardening fixes via
https://github.com/docker/libnetwork/pull/1796

Fixes multiple issues such as #32830

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 6868b8ef230fea7bc5758e2d252d4297033029fa
Component: engine
2017-06-12 01:01:45 -07:00
dd21307557 Increase the Coverage of pkg/plugins
Increases the test coverage of pkg/plugins.
Changed signature of function NewClientWithTimeout in pkg/plugin/client, to
take time.Duration instead of integers.

Signed-off-by: Raja Sami <raja.sami@tenpearl.com>
Upstream-commit: 8dd100a2297a34a0aef422383117fb0c3314fba1
Component: engine
2017-06-12 12:23:10 +05:00
bf95ed2bb9 Fix missing "--version" argument
Commit 858b4b44c8172eb2c92767c8f624f4138db5212b added
support for obtaining the runtime version
if a custom path was set, but accidentally
removed the "--version" flag.

This patch restores the flag, and adds an integration
test to verify the behavior..

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 6400ce8f0a97e456f9694396f58c0958f3580277
Component: engine
2017-06-11 23:31:47 +02:00
11c8449db6 container/stream/attach: use pools.Copy
The use of pools.Copy avoids io.Copy's internal buffer allocation.
This commit replaces io.Copy with pools.Copy to avoid the allocation of
buffers in io.Copy.

Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: 014095e6a07748d0e1ce2f759f5c4f4b3783e765
Component: engine
2017-06-10 21:13:33 +03:00
b183d65011 pkg/pools: add buffer32KPool & use it for copy
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: ba40f4593f79a653f1e3a8b9597b7900fb68a564
Component: engine
2017-06-10 21:12:48 +03:00
88e6e57d65 Merge pull request #175 from dnephin/golang-version
Print CircleCI docker version
Upstream-commit: f82f61efc6
Component: cli
2017-06-10 15:03:07 +02:00
33135ac6fd Merge pull request #33612 from thaJeztah/bump-api-version
Bump API version
Upstream-commit: 3f6b6c2981aa231823c51ed84ee0f89d81105c5b
Component: engine
2017-06-10 02:00:45 +02:00
1674838b6a Add API version checks to client
The Docker CLI already performs version-checks when
running commands, but other clients consuming the API
client may not do so.

This patch adds a version check to various
client functions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 1401342f466bafbb902157a2460746ac829e0b01
Component: engine
2017-06-10 01:57:55 +02:00
0aad6bdefb Do not calculate size for local volumes with mount
Local volumes support mount options which, when in use, can mount
external file systems. We don't really need to enumerate these external
filesystems which may be a very slow process.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 0822d903642e02c44b086e6856a30f80887412ee
Component: engine
2017-06-09 18:28:46 -04:00
159c952b6f Merge pull request #173 from StefanScherer/update-golang-1.8.3
Update golang 1.8.3
Upstream-commit: 6a963c5cbe
Component: cli
2017-06-09 15:10:04 -07:00
20321f4d70 Merge pull request #33590 from ijc/update-grpc
Update grpc to v1.3.0 and bump protobuf bindings.
Upstream-commit: 4741c0260573c8ee2bbc94a9c8e77630b457168c
Component: engine
2017-06-09 23:20:08 +02:00
1a30bcfcf2 Add a docker version print to CI
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: cda8281da8
Component: cli
2017-06-09 15:54:09 -04:00
83a1ff66bd Suggest login on pull denial
Signed-off-by: Alfred Landrum <alfred.landrum@docker.com>
Upstream-commit: 8d9f51ea55c8c9373d20bcc7561ca34c59aaf8c2
Component: engine
2017-06-09 12:43:21 -07:00
e9ff960979 Update golang 1.8.3
Signed-off-by: Stefan Scherer <scherer_stefan@icloud.com>
Upstream-commit: b38c49411b
Component: cli
2017-06-09 21:43:00 +02:00
2810834b91 Merge pull request #172 from adshmh/fix-secret-remove-testcase-error-message-leak
fixed the output leak from the error test case for secret/remove command
Upstream-commit: dd585ad4fb
Component: cli
2017-06-09 21:03:33 +02:00
a2e3a8a7ba Merge pull request #171 from adshmh/fix-stack-remove-testcase-error-message-leak
removed the output leaked from stack remove error test case
Upstream-commit: 45b02769f9
Component: cli
2017-06-09 21:03:22 +02:00
15c3a892ca fixed the output leak from secret/remove command error test case
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 77062a09dc
Component: cli
2017-06-09 13:21:14 -04:00
c9920c89e8 Merge pull request #33609 from thaJeztah/backport-29418
backport #29418 "Fix buildIpamResources()" to master
Upstream-commit: c9f26eaaf8b9f7977319d6d596f8701bbc58a108
Component: engine
2017-06-09 19:18:50 +02:00
2180c64b2f removed the output leaked from stack remove error test case
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Upstream-commit: 852bf0f96d
Component: cli
2017-06-09 12:14:18 -04:00
aed3533620 Bump API version
With the Moby/Docker split, no decisions have been
made yet how, and when to bump the API version.

Although these decisions should not be lead
by Docker releases, I'm bumping the API version
to not complicate things for now; after this bump
we should make a plan how to handle this in future
(for example, using SemVer for the REST api, and
bump with every change).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 7839ff2244a7fcbac0882b1426bbd2c5477c1abe
Component: engine
2017-06-09 14:58:01 +02:00
7910a90b94 Merge pull request #33424 from allencloud/add-swarm-unlock-test-in-client
add swarm unlock test in client
Upstream-commit: 47218448113da4a06d6b0397821007d2b865ede5
Component: engine
2017-06-09 08:39:23 -04:00
ae3f3a569b Merge pull request #32122 from allencloud/choose-rpc-code-to-determine-status-code
choose rpc code to determine status code
Upstream-commit: 27ca921db1d2b4f19fa60a5d7994fec29fb2d025
Component: engine
2017-06-09 14:32:24 +02:00
f2965d95e5 Merge pull request #33610 from thaJeztah/docs-cherry-picks
Docs back ports to master
Upstream-commit: c8c16abdb1dad1ad3616cbd256f7ee8f3be8249d
Component: engine
2017-06-09 14:22:46 +02:00
f5407ef319 Merge pull request #33606 from thaJeztah/master-cherry-picks
Backport 17.05.0-ce changelog to master
Upstream-commit: f1a945a5772f93549a549ba3c8f8a9ee16589258
Component: engine
2017-06-09 14:19:35 +02:00
9d1aaaa297 Merge pull request #33572 from hsluoyz/patch-1
Add Casbin plugin to the list of Authorization plugins in docs.
(cherry picked from commit 220831d541bfe9bf566c1038773198d431560dd3)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 0ad3e3294e74f443130b5e1fb1ef6b31f4f92366
Component: engine
2017-06-09 14:11:36 +02:00
74c45938b0 Merge pull request #32804 from bbodenmiller/patch-1
remove extra word
(cherry picked from commit 9db03bd8cdad3c8804105cb5794ebad5e728f48f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 3eaec0071c3ce1b7201e37859afe5bcb78d4f215
Component: engine
2017-06-09 14:06:37 +02:00
25d0a85dce Merge pull request #32791 from djalal/patch-1
fix typo
(cherry picked from commit 32a52716b964373b4ac464052e73ea5da79856c6)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: fcbd93f52032593cc71b298c00a46fd354356650
Component: engine
2017-06-09 14:06:31 +02:00
aa4ab28f5c Merge pull request #32735 from bhavin192/patch-1
Add note about host-dir in VOLUME
(cherry picked from commit f2fff9d913a8ab0436dd56033189a7c3713a59a2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 8fd6547fc3eb67e7efa7efb007ae6a4494cd2bb3
Component: engine
2017-06-09 14:06:25 +02:00
c377be4599 Merge pull request #32724 from PatrickLang/patricklang-win-memory
Adding more on -m and --memory
(cherry picked from commit c3fbca106552f2dadcb89510ff87945b50f36419)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: b4047a849bd3018f8a8eabf34613a4fca57f818e
Component: engine
2017-06-09 14:06:19 +02:00
6df95bba93 Merge pull request #32684 from scjane/patch-3
Update builder.md
(cherry picked from commit 831066337743fc29ff122fce51afe44b8b3b3ba9)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: bc66821abbcf50c721ce9b8f52b339fda102d389
Component: engine
2017-06-09 14:06:13 +02:00
758ca586cf Merge pull request #29418 from aboch/p66
[1.13.x] Fix buildIpamResources()
(cherry picked from commit 4d2be03b68dd54d8f2307e8b4178ad8ed8d5d343)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 27498a3c60018ea2880a18beec65710fd27971a7
Component: engine
2017-06-09 13:51:43 +02:00
a4b1e4c35b Merge pull request #29083 from cpuguy83/fix_volume_rm_metadata
[1.12.x] Fix issue where volume metadata was not removed
(cherry picked from commit 7613b23a583dba87f18005076ecbc84b408ebc5c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Conflicts:
	volume/store/store.go
	volume/store/store_test.go
Upstream-commit: 9ffbc8b8144917deed71a35d2f044f6e674c66f5
Component: engine
2017-06-09 13:44:59 +02:00
14c90f7c2a bump to GA
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
(cherry picked from commit 89658bed64c2a8fe05a978e5b87dbec409d57a0f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: d94f281d78e85f4c7de6b8347ab95d0afd5b8a8d
Component: engine
2017-06-09 11:51:56 +02:00
4df2617737 bump to rc2
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
(cherry picked from commit c57fdb2a14cfba584686ddad909e3006284d10aa)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: b4d36e47c3501541dc66b6336e286b8c11cbcec7
Component: engine
2017-06-09 11:51:45 +02:00
f5bb6cc898 Added Test Case Coverage for PKG/REEXEC
Signed-off-by: Naveed Jamil <naveed.jamil@tenpearls.com>
Upstream-commit: 7e03cebff42717a9a6f04cefdaab931fc152ba51
Component: engine
2017-06-09 12:08:04 +05:00
944e6f404a Increased Unit Test Coverage for PKG/SYSINFO
Signed-off-by: Naveed Jamil <naveed.jamil@tenpearls.com>
Upstream-commit: 6181bd7a7cf27bb2695c98708ce6464724a4c33a
Component: engine
2017-06-09 12:06:12 +05:00
ab0ee856b7 Merge pull request #33598 from aaronlehmann/remove-dumpdaemon
daemon: Remove daemon datastructure dump functionality
Upstream-commit: 252e610103e7fcb1b485b663ca89b1158f0a948b
Component: engine
2017-06-08 22:40:00 -04:00
a215dfc2d2 Merge pull request #33262 from keloyang/exec-block
Add a error check in postHijacked to avoid docker exec command blocking.
Upstream-commit: f35157433e38c90a9a067020609c7e250fc847af
Component: engine
2017-06-09 09:20:04 +08:00
4fad4bb5eb Merge pull request #33451 from naveed-jamil-tenpearls/pkg/signal/signal
Add test coverage to pkg/signal
Upstream-commit: 1a2d2f75f42696d295392b939346ed4a36ac0bfc
Component: engine
2017-06-08 16:51:23 -07:00
29886fb978 daemon: Remove daemon datastructure dump functionality
When sending SIGUSR1 to the daemon, it can crash because of a concurrent
map access panic, showing a stack trace involving dumpDaemon. It appears
it's not possible to recover from a concurrent map access panic. Since
it's important that SIGUSR1 not be a destructive operation, sadly the
best course of action I can think of is to remove this functionality.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: a4c68ee8574c9b8a3309ebebee0d90108042ba61
Component: engine
2017-06-08 14:08:49 -07:00
81261f8161 Merge pull request #166 from thaJeztah/update-term
Bump docker/docker to cd35e4beee13a7c193e2a89008cd87d38fcd0161
Upstream-commit: a74e715b1a
Component: cli
2017-06-08 13:45:32 -07:00
8a1bab985d Merge pull request #33520 from naveed-jamil-tenpearls/pkg/term
Add test coverage to pkg/term
Upstream-commit: e57f8a78ae3291670c903784864d04139c821ea1
Component: engine
2017-06-08 13:41:49 -07:00
92da3a16e3 Merge pull request #121 from nishanttotla/digest-pinning-stack-deploy
Enable client side digest pinning for stack deploy
Upstream-commit: 4d980880f3
Component: cli
2017-06-08 23:20:02 +03:00
e390db6238 Move IsArchive and HeaderSize to build/context
Previously these were in docker/docker/pkg/archive, but unused

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 0310de5213
Component: cli
2017-06-08 16:08:11 -04:00
f41b60a28b Merge pull request #168 from thaJeztah/bump-version
Update version to 17.07-dev
Upstream-commit: b1ea2e4eb5
Component: cli
2017-06-08 15:58:35 -04:00
501eac5305 Update version to 17.07-dev
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 75238f3aa9
Component: cli
2017-06-08 21:45:37 +02:00
13d2adae3f Fix copy when used with scratch and images with empty RootFS
Commit the rwLayer to get the correct DiffID
Refacator copy in thebuilder
move more code into exportImage
cleanup some windows tests
Release the newly commited layer.
Set the imageID on the buildStage after exporting a new image.
Move archiver to BuildManager.
Have ReleaseableLayer.Commit return a layer
and store the Image from exportImage in the local imageSources cache
Remove NewChild from image interface.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 51360965206b0db49cc0365dabb590063a17a9df
Component: engine
2017-06-08 15:07:16 -04:00
7be28755e3 Rename LazyContext to LazySource.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: ecd44d23cc3c863c20467377cf568b920e2dd89c
Component: engine
2017-06-08 15:07:15 -04:00
932c771fa1 Remove CopyOnBuild from the daemon.
Add CreateImage() to the daemon
Refactor daemon.Comit() and expose a Image.NewChild()
Update copy to use IDMappings.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: bd5f92d2631df7c932b93e72e45b39cba19f2f3b
Component: engine
2017-06-08 15:06:54 -04:00
a2df58226d Always exit whith -1 when remove image with force option
Signed-off-by: Rogelio Canedo <rcanedo@mappy.priv>
Upstream-commit: 5c8d702af5
Component: cli
2017-06-08 20:15:37 +02:00
af7c7c63d1 Merge pull request #33546 from runcom/init-runtime-info
daemon: correctly try to retrieve init/runtime versions
Upstream-commit: 274cc09247696c56017aed6bafb1089bd2ebbfde
Component: engine
2017-06-08 10:32:50 -07:00
5beabf7afd Merge pull request #33583 from naag/33569-logging-plugin-file-inconsistency
Pass the same log filename to logging plugins on start/stop requests
Upstream-commit: d053bdef15ba4e2f645687eaee1dd8b9322a5658
Component: engine
2017-06-08 17:36:52 +02:00
696660014b Bump docker/docker to cd35e4beee13a7c193e2a89008cd87d38fcd0161
Reverts changes in pkg/term related to `OPOST` that pulled in through;
3574e6a674

And reverted upstream in;
cd35e4beee

Full diff;
c8141a1fb1...cd35e4beee

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: efd11bf69d
Component: cli
2017-06-08 16:27:49 +02:00
6eb59ca44c Update grpc to v1.3.0 and bump protobuf bindings.
and update some dependent packages.

We would like to keep moby/moby and swarmkit somewhat in sync here and
https://github.com/docker/swarmkit/pull/2229 proposes a similar bump to
swarmkit, needed due to https://github.com/docker/swarmkit/pull/1965 which
pulls in containerd which uses some newer features of the grpc package.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
Upstream-commit: 379557a95873aad26b7eb20a7a48f8e1e7551041
Component: engine
2017-06-08 14:34:23 +01:00
228595a0e9 fix aufs mount option length calculation
We add ",dirperm1" but only increase length by len("dirperm1").

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Upstream-commit: 1a6bf8248a32c160347e4daf3dd4f15023357889
Component: engine
2017-06-08 19:21:52 +08:00
8b832283fa Merge pull request #111 from keloyang/attach-restarting-check
Add a restarting check to runAttach
Upstream-commit: ab3ea637b6
Component: cli
2017-06-08 12:53:15 +02:00
ce2ce71b2e Merge pull request #163 from vdemeester/export-convertservice
Update ConvertService for external usage 👼
Upstream-commit: c944d20b1f
Component: cli
2017-06-08 10:55:56 +02:00
ba21fcb357 Update ConvertService for external usage 👼
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 96dc07a8cf
Component: cli
2017-06-08 10:44:05 +02:00
a53424fe86 Logging driver should receive same file in start/stop request
Signed-off-by: Peter Bücker <peter.buecker@gmail.com>
Upstream-commit: e908e1a357b435d7fab497d51cdd3e58458a0590
Component: engine
2017-06-08 10:05:52 +02:00
fef5c78683 Add test coverage to pkg/term/proxy.go
Signed-off-by: Naveed Jamil <naveed.jamil@tenpearls.com>
Upstream-commit: a267248b5af9e58f878b0e2ba604c7256d637be2
Component: engine
2017-06-08 12:48:33 +05:00
523841f2f9 Add a error check in postHijacked to avoid docker exec command blocking.
When user execute docker exec command, docker daemon maybe have err return because
of ExecExists check, and then the hijack stream will not be close, it can lead to
docker exec command block.

Signed-off-by: yangshukui <yangshukui@huawei.com>
Upstream-commit: 26231b29e7881d25822bffd740d5f73fc2687460
Component: engine
2017-06-08 15:46:50 +08:00
042ba9639d Merge pull request #33577 from crosbymichael/revert-ONCLR
Revert ONCLR and OPOST changes
Upstream-commit: cd35e4beee13a7c193e2a89008cd87d38fcd0161
Component: engine
2017-06-07 21:50:38 -07:00
5aa484e047 Merge pull request #33555 from mavenugo/rc3-vin
Vendoring libnetwork and netlink
Upstream-commit: a82999cfd3328ecec11f5482be09c1756be190a6
Component: engine
2017-06-07 21:45:05 -07:00
5a336fdfb9 Merge pull request #33578 from mavenugo/taskalias
Service alias should not be copied to task alias
Upstream-commit: 1678c7add9dfb228fbe63c40ddcdd2ae8327b793
Component: engine
2017-06-07 21:44:35 -07:00
b16298c7bf Merge pull request #33456 from cpuguy83/fix_concurrent_map_access_issue
Lock container while connecting to a new network.
Upstream-commit: 4051ee6ad617c71c033d9302d0039bc630581980
Component: engine
2017-06-07 21:44:04 -07:00
b190ae1082 Add a restarting check to runAttach
Signed-off-by: Shukui Yang <yangshukui@huawei.com>
Upstream-commit: 90f497302f
Component: cli
2017-06-08 07:12:39 +08:00
8d3a4135a1 Replace command.DockerCli to command.Cli in docker attach/exec command
Signed-off-by: Shukui Yang <yangshukui@huawei.com>
Upstream-commit: e8cc2cf760
Component: cli
2017-06-08 07:03:52 +08:00
aa5990df73 Merge pull request #33362 from dnephin/refactor-uid-maps
Partial refactor of UID/GID usage to a new struct
Upstream-commit: 34536c498d56a0c74fab08bd434407ac4707c971
Component: engine
2017-06-07 15:12:10 -07:00
f3ef17e47d Revert ONCLR and OPOST changes
This reverts to a version of runc without the ONCLR cleared to not cause
a regression with different clients using --tty.

This also reverts the OPOST changes to the term package to support the
initial change.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: a5e83836a49547b2add871bb52cbd8bfedb57114
Component: engine
2017-06-07 13:14:52 -07:00
01293c3a07 Merge pull request #33549 from ripcurld0/update_swagger
Describe the differences between container-inspect and container-list
Upstream-commit: 36db52a7049c0f00e75f7cfcbd5061dc7600180f
Component: engine
2017-06-07 22:08:26 +02:00
7911166df9 Service alias should not be copied to task alias
If a service alias is copied to task, then the DNS resolution on the
service name will resolve to service VIP and all of Task-IPs and that
will break the concept of vip based load-balancing resulting in all the
dns-rr caching issues.

This is a regression introduced in #33130

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 38c15531501578b96d34be5ce7f33a0be6be078f
Component: engine
2017-06-07 13:05:15 -07:00
31ea0d23c1 Change --no-resolve-image flag to --resolve-image string flag
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: f790e839fc
Component: cli
2017-06-07 12:30:11 -07:00
e0b0f9479e Enable client side digest pinning for stack deploy
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: 9f1bea2657
Component: cli
2017-06-07 12:30:11 -07:00
b25d5c64ec Merge pull request #162 from vdemeester/150-configs-fixes-on-old-daemon
Handle case of configs on old daemon
Upstream-commit: 08cb0bddfd
Component: cli
2017-06-07 12:18:32 -07:00
e0f9d48624 Clarify ability to attach multiple times
Signed-off-by: Misty Stanley-Jones <misty@docker.com>
Upstream-commit: b5d33c6e76
Component: cli
2017-06-07 09:40:43 -07:00
8dd1ea1814 Merge pull request #33557 from AkihiroSuda/test-no-unset
builder: add a test for `ENV name` (without `=value`)
Upstream-commit: d2c6e78371824bf7f9063814e8b34caa0c97ed56
Component: engine
2017-06-07 17:51:42 +02:00
1b8c1463bf Merge pull request #145 from dnephin/improve-compose-secrets-errors
Compose: Improve error messages when resource create/update fails
Upstream-commit: 9d12d6fc87
Component: cli
2017-06-07 18:51:10 +03:00
583893964e Remove error return from RootPair
There is no case which would resolve in this error. The root user always exists, and if the id maps are empty, the default value of 0 is correct.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 93fbdb69acf9248283a91a1c5c6ea24711c26eda
Component: engine
2017-06-07 11:45:33 -04:00
b35fc7f268 Remove MkdirAllNewAs and update tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 6150ebf7b483197f4b8755df60e750b6410e95ca
Component: engine
2017-06-07 11:44:34 -04:00
f40a1d3270 Remove ToHost and replace it with IDMappings.ToHost
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: df248d31d9d61342575fc1b5d3d848f0b282bbc5
Component: engine
2017-06-07 11:44:34 -04:00
03637cd7aa Fix vfs unit test and port VFS to the new IDMappings
The test was failing because TarOptions was using a non-pointer for
ChownOpts, which meant the check for nil was never true, and
createTarFile was never using the hdr.UID/GID

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: acdbc285e29ddd92e7a1cc99daf8b16502204d2e
Component: engine
2017-06-07 11:44:34 -04:00
c41fc33a7a Convert tarAppender to the newIDMappings.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 5672eeb5e06fe96451f36f35be7cfa18a4cf5063
Component: engine
2017-06-07 11:44:34 -04:00
5d87b0ddc9 Remove unused functions from archive.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 967ef7e6d2bd88a5d7010863f3d7138ca61b1939
Component: engine
2017-06-07 11:44:33 -04:00
779caabedf Partial refactor of UID/GID usage to use a unified struct.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 09cd96c5ad2de369912cdf708c3c50f41e4586ac
Component: engine
2017-06-07 11:44:33 -04:00
77734a6c63 Merge pull request #161 from vdemeester/update-codecov-threshold
Update codecov project threshold to 15%
Upstream-commit: 230b9eaf1a
Component: cli
2017-06-07 11:13:19 -04:00
85d6b4b742 Handle case of configs on old daemon
If configs are declared for a service and pointing on an old
daemon, error out properly (instead of "page not found").

If there is no configs declared, don't call convertServiceConfigObjs
to avoid having an error.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: cf5550c426
Component: cli
2017-06-07 17:02:46 +02:00
af043a1e5b Vendoring libnetwork and netlink
libnetwork eb57059e91bc54c9da23c5a633b75b3faf910a68
netlink bd6d5de5ccef2d66b0a26177928d0d8895d7f969

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 5fd65a6b6c524e670f3b4ccced3974f63c1fd9a6
Component: engine
2017-06-07 06:20:27 -07:00
d8fa98915a Update codecov project threshold to 15%
That way, the build will fail less.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: a132733939
Component: cli
2017-06-07 13:26:24 +02:00
6125da9d13 Merge pull request #155 from vdemeester/fix-and-update-vendor
Update vendoring of docker/docker
Upstream-commit: 583ed2e3be
Component: cli
2017-06-07 14:25:57 +03:00
1ce23eb137 Merge pull request #33536 from aaronlehmann/silly-sprintfs
client: Use string concatenation instead of Sprintf
Upstream-commit: d2a83863ed764118ac985157c51418e434a8e354
Component: engine
2017-06-07 11:34:37 +02:00
63a5fba1a8 builder: add a test for ENV name (without =value)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Upstream-commit: 09eca591f723f9acd0909b04144c229b6cd59912
Component: engine
2017-06-07 05:23:26 +00:00
91bac6c3f8 Merge pull request #33330 from coolljt0725/fix_sock_is_dir
Don't create source directory while the daemon is being shutdown, fix #30348
Upstream-commit: cd2255a296acf8408d2afb65b897560479f1ecd3
Component: engine
2017-06-07 12:37:08 +09:00
fea3e9d9a8 Merge pull request #33463 from mavenugo/ln-vin-1706
Vendoring libnetwork 2e99f06621c23a5f4038968f1af1e28c84e4104e
Upstream-commit: 64bb44546355053713e798e1ca021d280ddb8df7
Component: engine
2017-06-06 20:24:17 -07:00
3c1a09fba3 Merge pull request #33547 from vieux/report-2017-06-05
Moby Dev Report 2017 06 05
Upstream-commit: 18ce8ce33fa8e946fc90026e9c57ae9f8d5fed7c
Component: engine
2017-06-06 18:56:15 -07:00
4eb3d3cbf0 Moby report 2017-06-05
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 7a295b03336e48b0596d0e4d44ae19add3a56fb3
Component: engine
2017-06-06 18:53:09 -07:00
1037ee0af4 Use internal systemd scripts for DEB packaging
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 477d0b1f735f7e243425cd2c5f48e8f216556c2f
Component: packaging
2017-06-06 14:56:39 -07:00
418eb3ce3d Use internal systemd scripts for RPM packaging
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: cbfe576e680b19c5f4c992e52bee59f2bc540026
Component: packaging
2017-06-06 14:27:41 -07:00
5b073ee2cf Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-06-06 21:12:46 +00:00
df30a62f60 Merge pull request #15 from andrewhsu/s390x
set $GOPATH/bin for s390x
Upstream-commit: baad4ca43af324a8e7758084054fd1ca30e13e10
Component: packaging
2017-06-06 14:09:00 -07:00
f34782e802 set $GOPATH/bin for s390x
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: f6d30c3631abee04aa3586cba36960901f705fe2
Component: packaging
2017-06-06 19:54:54 +00:00
b91462c403 Merge pull request #29427 from yongtang/29325-cleanup-btrfs-quota-groups
Remove btrfs quota groups after containers destroyed
Upstream-commit: 54dacaf23eaec0a5fd7d77ee906f08175d485bb7
Component: engine
2017-06-06 12:51:00 -07:00
3b7dc655ab Fix check-git-diff so that it fails on CI
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f75a44ffd8
Component: cli
2017-06-06 15:06:34 -04:00
c982c7adf3 Merge pull request #14 from andrewhsu/notty
no need for tty
Upstream-commit: d3e0c2e866ea3a0f01c36830eca010985848a04e
Component: packaging
2017-06-06 11:38:36 -07:00
402bd4febb no need for tty
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: ade95a2b6f8a16aa7e6c387dc9c9dd48bba9a672
Component: packaging
2017-06-06 18:33:59 +00:00
cc0cc953be Describe the differences between container-inspect and container-list
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: e8a1d99afb42d0931f7e1fd3df41611aafddf5a9
Component: engine
2017-06-06 21:33:08 +03:00
cbb74e3fb4 Add initial systemd scripts
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 7b31f87ffd8115f8226f68b788f5b36db53981f6
Component: packaging
2017-06-06 11:32:27 -07:00
28fd21b9d9 Merge pull request #33524 from dnephin/fix-onbuild-copy-cache
[Builder] Fix Cache with ONBUILD
Upstream-commit: f50249964788c144c2059f2c63e2f54473317ed3
Component: engine
2017-06-06 10:44:57 -07:00
bd56d0486b daemon: correctly try to retrieve init/runtime versions
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 858b4b44c8172eb2c92767c8f624f4138db5212b
Component: engine
2017-06-06 19:36:24 +02:00
a7fe10a440 Fix Cache with ONBUILD
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f1ade82d82e6436971c6b7d08eb1da57ed9ba756
Component: engine
2017-06-06 10:52:29 -04:00
5f0ae0b377 integration-cli: Replace sleeps with polling in swarm lock/unlock tests
This will hopefully make the tests more robust by replacing a fixed 3s
sleep with a polling loop that looks at whether the key PEM file is
encrypted or not.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 17173efbe00d422392f91c672350266314808b28
Component: engine
2017-06-06 16:28:40 +03:00
8c5fc4b2de Merge pull request #33516 from shishir-a412ed/remove_auth_config
Remove dead code: GetAuthConfig
Upstream-commit: 84149ac17d8ebfe8fc8995d9152114ed3071e884
Component: engine
2017-06-06 14:20:19 +02:00
9950f73370 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-06-06 08:58:58 +00:00
fc32bb21ac Merge pull request #12 from andrewhsu/gen-man
generate man pages
Upstream-commit: b39d336d7f75858574b90531dbd6201d355c474a
Component: packaging
2017-06-06 01:56:49 -07:00
0164928deb Merge pull request #158 from tiborvass/fix-manpages-script
Fix manpages script
Upstream-commit: 51b00f966e
Component: cli
2017-06-06 10:44:58 +02:00
1b97ea3876 generate man pages
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: e14fca86f8230e10d79a7bfae2873a98a16bb44d
Component: packaging
2017-06-06 08:39:39 +00:00
a037b250cf Merge pull request #33471 from Snorch/sysconf-nrprocessors-onln-errno
Do not treat C.sysconf(C._SC_NPROCESSORS_ONLN) non-zero errno as error
Upstream-commit: 8b1adf55c2af329a4334f21d9444d6a169000c81
Component: engine
2017-06-06 10:22:41 +02:00
9b7bef68dd fix manpages script
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: dc81def89c
Component: cli
2017-06-06 05:00:10 +00:00
9244630a6b choose rpc code to determine status code
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: f257f77c6c13ee851d3b899f8d51628a5dec92db
Component: engine
2017-06-06 10:08:50 +08:00
cf0286328e Add builder dev report for 2017-06-05
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 0477bc4587d025b5b9b54ab810b6503b568d085c
Component: engine
2017-06-05 18:18:32 -07:00
a920b458df Update vendoring of docker/docker
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 44ac80881f
Component: cli
2017-06-06 00:23:21 +02:00
147ce7926d Merge pull request #154 from tiborvass/add-man-docs-scripts
Add scripts and targets for manpages and yamldocs
Upstream-commit: ed5b663082
Component: cli
2017-06-05 13:20:56 -07:00
4bf796daf6 Add scripts and targets for manpages and yamldocs
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: ff615dbc4d
Component: cli
2017-06-05 19:10:44 +00:00
b93aa08e64 Add link to docker-ce-packaging repo 2017-06-05 17:59:49 +02:00
a9c76c4bc8 Merge pull request #32293 from moypray/save_delete
Fix delete a image while saving it, delete successfully but failed to save it
Upstream-commit: c8141a1fb1ff33b2bfab85a40e5da9a282f36cdc
Component: engine
2017-06-05 09:55:56 -04:00
80e1c19817 Merge pull request #33500 from dnephin/fix-onbuild-copy
Fix ONBUILD COPY
Upstream-commit: 34f1cd26b67271c0fce60ab87c0c51e28f1ab6f2
Component: engine
2017-06-05 11:48:57 +02:00
56fb42b612 Remove dead code: GetAuthConfig
Signed-off-by: Shishir Mahajan <shishir.mahajan3@gmail.com>
Upstream-commit: 02a759fa96bd16c0483c8e48c5658ee6b9739aa4
Component: engine
2017-06-05 00:40:47 +00:00
76a64335a0 Merge pull request #33511 from vdemeester/remove-more-opts-runconfig
Remove some more `opts` from runconfig (not used anymore)
Upstream-commit: 7cf17f95f88bd61e677d722229b223cfe76ab6a0
Component: engine
2017-06-04 13:17:05 +09:00
c063e79268 Merge pull request #33512 from vdemeester/clean-cli-required
Remove unused functions
Upstream-commit: cc5ab6e6d45171f9fda4e77a6c52717d75c14e4b
Component: engine
2017-06-04 13:15:55 +09:00
b13daf9d28 Remove unused functions
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 236a125c3afdee30b739399aaea263c37cb28b04
Component: engine
2017-06-03 15:19:10 -07:00
b52fb8f6d2 Remove some more opts from runconfig (not used anymore)
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: b0226a890fa6c25cd9664d037114237a1d85b602
Component: engine
2017-06-03 15:07:33 -07:00
451b8c0ac8 Merge pull request #33502 from crosbymichael/bsd-opost
Set OPOST on bsd
Upstream-commit: df423d57936bf6e94bb1e54892f5419e1d927708
Component: engine
2017-06-03 02:30:58 +02:00
e9e0d884b4 Merge pull request #33477 from dnephin/move-builder-pkgs
Split and remove pkg/gitutils and pkg/httputils
Upstream-commit: b28cbed66df6ad06afd2d91b3c67245459ec37ff
Component: engine
2017-06-02 17:07:45 -07:00
5e2107c6ca Merge pull request #33496 from Microsoft/jjh/removedummy
Windows: Correct comment
Upstream-commit: 56da020e6b05c5cb15867049dccc79b51a6e0abb
Component: engine
2017-06-03 01:07:26 +02:00
84857b6959 Merge component 'cli' from git@github.com:docker/cli master 2017-06-02 22:37:41 +00:00
4358607de5 Fix ONBUILD COPY
the source was missing from the second dispatch

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3f2604157790408acf5ad05c74cebe105f2b6979
Component: engine
2017-06-02 17:47:03 -04:00
cd41e3bb53 Merge pull request #33483 from moypray/grpc_timeout
Limit max backoff delay to 2 seconds for GRPC connection
Upstream-commit: 8420e7e7f5bea6cc4aafc943efe88e483ec5ac0a
Component: engine
2017-06-02 14:22:10 -07:00
b8e386fca4 Move pkg/gitutils to remotecontext/git
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b9d85ac58db8b8d4480fca93f8b952d084ea36f5
Component: engine
2017-06-02 16:54:50 -04:00
b9c4f53912 Remove the last of pkg/httputil
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 4060d6ee0b130cf74294c309dfbd3c860fd2a7f8
Component: engine
2017-06-02 16:54:36 -04:00
16c0836e84 Move an error helper to registry/session.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: a6ac5495e11d34b1887476ca89f841df1056249a
Component: engine
2017-06-02 16:10:40 -04:00
7636bfd2c7 Move httputils/reasumablerequestreader to the single consumer.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 65515af075ce5f8037750c253b2834008840afc1
Component: engine
2017-06-02 16:10:39 -04:00
04eec7106a Move httputils/mimtype to the single consumser, and remove unused function.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: c91521be68182b450a22f018ccc9d780571a5936
Component: engine
2017-06-02 16:10:39 -04:00
899cb8ee5f Set OPOST on bsd
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 17ec46a24316f59c808c112e3ca46d7c442a785a
Component: engine
2017-06-02 12:53:49 -07:00
2764166c95 Merge pull request #147 from tiborvass/import-man-docs-completion
Import man docs completion
Upstream-commit: d95fd2f38c
Component: cli
2017-06-02 12:36:15 -07:00
3386def242 Windows: Correct comment
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 6e33c4158cc895d9b7fb274c13ecac0612c88aaa
Component: engine
2017-06-02 11:51:30 -07:00
048c29d376 Whitelist adjtimex get operation. Adjustment operations are gated by CAP_SYS_TIME
Signed-off-by: Miklos Szegedi <miklos.szegedi@cloudera.com>
Upstream-commit: 2db05316d09214f5cd6de24e9f17784cbc2f2573
Component: engine
2017-06-02 18:48:16 +00:00
9968cd1aa2 Add stream format details for attach/logs endpoint
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 48829ddf885eb656bff6dcf053bf96471b106bf0
Component: engine
2017-06-02 12:32:25 -04:00
7e488b89ed Add unit tests for service/ps
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 3718833f2c
Component: cli
2017-06-02 11:29:19 -04:00
9c0a0d808c Merge pull request #33438 from vdemeester/remove-cli-flags
Remove `cli/flags` package
Upstream-commit: aebcdf21b198f1ebaa7bb047282112b74f9f4490
Component: engine
2017-06-02 17:20:05 +02:00
013b9a64df Merge pull request #33485 from tpot/33484-fix-file-perm-octal
Use octal values for file mode in filenotify poller and sysinfo_linux tests
Upstream-commit: 91e0141784ab5570fd7f94ad4af399d23c827391
Component: engine
2017-06-02 11:15:42 -04:00
6f84604b78 client: Use string concatenation instead of Sprintf
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 44c9ccc069c1bfda25ad6fb5932eeeceaa8de491
Component: engine
2017-06-02 14:01:57 +02:00
6d3cd41f83 Limit max backoff delay to 2 seconds for GRPC connection
Docker use default GRPC backoff strategy to reconnect to containerd when
connection is lost. and the delay time grows exponentially, until reaches 120s.

So Change the max delay time to 2s to avoid docker and containerd
connection failure.

Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
Upstream-commit: d3d8c77d195ce74f36ae6eee24578b9cac48f897
Component: engine
2017-06-02 18:19:09 +08:00
97873b880b Merge pull request #33479 from vieux/move_multireader
move multireader out of /pkg
Upstream-commit: 096eeb3e75e9c76ec30f35356b2a4e46b0b51ed2
Component: engine
2017-06-02 12:04:57 +02:00
04c14c1983 Merge pull request #33464 from cyli/mask-ca-key-formdata
Do not log the CA config CA signing key in debug mode.
Upstream-commit: c0ed8f06d57ea34c98dd36ba7b950c366ba9781e
Component: engine
2017-06-02 11:56:08 +02:00
00a54e78b7 Merge pull request #33481 from tpot/33480-fix-assert-message
Fix incorrect assert message in TestReadProcBool
Upstream-commit: 7057f6fa0cac7413f113ccd718bb7c8d7c34e583
Component: engine
2017-06-02 11:52:29 +02:00
73a826b637 Merge pull request #33473 from thaJeztah/update-deprecated
Update deprecated.md for removal of --email flag
Upstream-commit: 9ff8068ca2bb1ba308ceec8f6a6ccb0fe7e7e746
Component: engine
2017-06-02 08:57:21 +02:00
481488ba68 Merge pull request #143 from thaJeztah/remove-email-flag
Remove deprecated -e/--email flag from docker login
Upstream-commit: a0066a150b
Component: cli
2017-06-02 08:56:07 +02:00
cfcd7c0452 Merge pull request #33436 from Microsoft/jjh/parserdirective
Builder: Fix parser directive refactoring
Upstream-commit: 57ca00240b9b73d967aad1deae07294fef092f98
Component: engine
2017-06-01 21:21:46 -07:00
a81b0c835e Persist the quota size for btrfs so that daemon restart keeps quota
This commit is an extension of fix for 29325 based on the review comment.
In this commit, the quota size for btrfs is kept in `/var/lib/docker/btrfs/quotas`
so that a daemon restart keeps quota.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 16328cc207a493ecff0cabc11ebf51e958131418
Component: engine
2017-06-01 21:15:51 -07:00
080b2a353f Remove btrfs quota groups after containers destroyed
This fix tries to address the issue raised in 29325 where
btrfs quota groups are not clean up even after containers
have been destroyed.

The reason for the issue is that btrfs quota groups have
to be explicitly destroyed. This fix fixes this issue.

This fix is tested manually in Ubuntu 16.04,
with steps specified in 29325.

This fix fixes 29325.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: e907c6418a2ae7754f69fede5897a7176250e8bd
Component: engine
2017-06-01 20:24:26 -07:00
f9502cbcaf Use octal values for file mode in filenotify poller and sysinfo_linux tests
Closes #33484.

Signed-off-by: Tim Potter <tpot@hpe.com>
Upstream-commit: c35ea6b2cda8ac68f2b4a9f6471ca7e09865a6ee
Component: engine
2017-06-02 12:27:10 +10:00
b6073e5ee6 Fix incorrect assert message in TestReadProcBool
Closes #33480.

Signed-off-by: Tim Potter <tpot@hpe.com>
Upstream-commit: cd457e7885ecb0b00e91162113ce597f131c8386
Component: engine
2017-06-02 10:15:58 +10:00
a1a5b0a48d move multireader out of /pkg
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: 2445e6b99d4beecb25d556d9a099bdf47703e174
Component: engine
2017-06-01 16:22:00 -07:00
d6016b7163 Merge pull request #33474 from mlaventure/test-with-actual-cli-version
Use actual cli version for TestConfigHTTPHeader
Upstream-commit: 986510951ae3c1accb7c6be2993f54300edcad77
Component: engine
2017-06-01 16:18:04 -07:00
ae6e09bc74 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-06-01 23:09:14 +00:00
10e27f6561 Merge pull request #33335 from cpuguy83/33334_check_unset_sig
Check signal is unset before using user stopsignal
Upstream-commit: 872e28bb1452c6e333549a55dcb651fcff2a6bd1
Component: engine
2017-06-01 23:10:16 +02:00
089484b881 Merge component 'cli' from git@github.com:docker/cli master 2017-06-01 21:02:34 +00:00
aa101def38 Merge component 'engine' from git@github.com:moby/moby master 2017-06-01 20:46:42 +00:00
1fd0a9619a Remove cli/flags package
- Moving the `common*.go` files in `cmd/dockerd` directly (it's the
  only place it's getting used)
- Rename `cli/flags` to `cli/config` because it's the only thing left
  in that package 👼

Now, `integration-cli` does *truly* not depend on `cobra` stuff.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 9ff9a91ab7f964f4e5042f94fe22dd50b5c3d832
Component: engine
2017-06-01 13:34:31 -07:00
cd8431c122 Use a map instad of a switch/case for Compose transform.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 97ebc19438
Component: cli
2017-06-01 15:22:09 -04:00
25b6069bb2 Compose: Improve error messages when resource creation/updates fail.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 729d07a371
Component: cli
2017-06-01 15:03:04 -04:00
5f4e132587 Merge pull request #144 from thaJeztah/allow-some-flags-during-rollback
Allow --detach and --quiet flags when using --rollback
Upstream-commit: 30af87981d
Component: cli
2017-06-01 14:47:08 -04:00
d4709bb827 Merge pull request #33446 from raja-sami-10p/pkg/platform
Increase the Coverage of pkg/platform
Upstream-commit: 7ff205571f6016c10638e16026d1673b2f5b6615
Component: engine
2017-06-01 19:14:15 +02:00
eb999c14d0 Add builder dev report for 2017-05-29
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 1e1ec2fbca9aa67882ebc722dbdbc50c54255660
Component: engine
2017-06-01 09:46:20 -07:00
be69462c28 Use actual cli version for TestConfigHTTPHeader
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 0b90edc22fa95e04b4d3208a72bb276be699b260
Component: engine
2017-06-01 09:35:30 -07:00
67be6e9ac8 Fix complexity of service/ps.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b5baffde44
Component: cli
2017-06-01 11:49:16 -04:00
008c8eb206 Do not treat C.sysconf(C._SC_NPROCESSORS_ONLN) non-zero errno as error
Treat return code -1 as error instead.

People from glibc say that errno is undefined in case of successful
sysconf call according to POSIX standard:
Glibc bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21536

More over in sysconf man it is wrongly said that "errno is not changed"
on success. So I've created a bug to man-pages:
https://bugzilla.kernel.org/show_bug.cgi?id=195955

Background: Glibc's sysconf(_SC_NPROCESSORS_ONLN) changes errno to
ENOENT, if there is no /sys/devices/system/cpu/online file, while
the call itself is successful. In Virtuozzo containers we prohibit
most of sysfs files for security reasons. So we have Run():daemon
/stats/collector.go infinitely loop never actualy collecting stats
from publisher pairs.

v2: add comment

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Upstream-commit: dec084962eab41eb20b1808955de34cfec4fc8b3
Component: engine
2017-06-01 18:23:49 +03:00
830b3113ae Merge pull request #136 from johnstep/fix_stack_service_volumes
Fix stack compose bind-mount volumes for Windows
Upstream-commit: bf22fc6781
Component: cli
2017-06-01 11:06:06 -04:00
9d937bfa88 Update deprecated.md for removal of --email flag
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 43239f62bedc4721d27744d21c122622988bb3ae
Component: engine
2017-06-01 17:05:42 +02:00
e1f6bc3e4f Allow --detach and --quiet flags when using --rollback
Commit 78c204ef79 added
(f9bd8ec8b268581f93095c5a80679f0a8ff498bf in the moby repo)
a validation to prevent `--rollback` from being used
in combination with other flags that update the
service spec.

This validation was not taking into account that
some flags only affect the CLI behavior, and
are okay to be used when rolling back.

This patch updates the validation, and adds
`--quiet` and `--detach` to the list of allowed
flags.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: f10f29df8d
Component: cli
2017-06-01 16:31:07 +02:00
5f38794750 Merge pull request #32590 from moypray/containerd
Fix when containerd restarted, event handler may exit
Upstream-commit: d7c125791a3fa6cf233a8f9d017c28ae65d5b535
Component: engine
2017-06-01 08:16:24 -04:00
d0a95fbfec Remove deprecated -e/--email flag from docker login
The `docker login -e` / `docker login --email` option was deprecated in
Docker 1.11 (https://github.com/moby/moby/releases/tag/v1.11.0) through
aee260d4eb3aa0fc86ee5038010b7bbc24512ae5 (April 2016), and when used has
been outputing a deprecation warning since;

    Flag --email has been deprecated, will be removed in 17.06.

Originally this option was scheduled to be removed in docker 1.13, but
extended to docker 17.06 due to a change in our deprecation policy.

Given that only docker 1.10 and older use this flag (which is EOL, including
for CS versions, as of February 2017), will now be removed.

With this patch, `docker login` will now produce an Error if the flag
is used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 8b383d2351
Component: cli
2017-06-01 12:55:04 +02:00
52c11cb152 Fix delete a image while saving it, delete successfully but failed to save it
Issue Description:
 * 1. Saving more than one images, `docker save -o a.tar aaa bbb`
 * 2. Delete the last image which in saving progress.  `docker rmi bbb`

Espected:
 Saving images operation shouldn't be disturbed. But the real result is that failed to
save image and get an error as below:
  `Error response from daemon: open
/var/lib/docker/image/devicemapper/imagedb/content/sha256/7c24e4d533a76e801662ad1b7e6e06bc1204f80110b5623e96ba2877c51479a1:
no such file or directory`

Analysis:
  1. While saving more than one images, it will get all the image info from reference/imagestore,
     and then using the `cached data` to save the images to a tar file.
  2. But this process doesn't have a resource lock, if a deletion operation comes, the image will be deleted,
     so saving operation will fail.

Solution:
 When begin to save an image, `Get` all the layers first. then the
deletion operation won't delete the layers.

Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
Upstream-commit: 4a014e6b0d7e2d310ee1ba442128a6802559a63a
Component: engine
2017-06-01 18:13:20 +08:00
e17da42389 Add test coverage to pkg/signal
Signed-off-by: Naveed Jamil <naveed.jamil@tenpearls.com>
Upstream-commit: 4b0df45c1a261354f10abb151b9acfa6b61f517d
Component: engine
2017-06-01 14:53:15 +05:00
b289cb3026 Merge pull request #33465 from ChenMin46/fix_typos
Fix Typos: continer,contianer -> container
Upstream-commit: 9fbcec6219aad74201da428b0b12141b5c812609
Component: engine
2017-06-01 13:52:18 +09:00
02f992f2b8 Fix Typos: continer,contianer -> container
Signed-off-by: Chen Min <chenmin46@huawei.com>
Upstream-commit: 2b62eb434be4770c101ef79666a952fd7f43a742
Component: engine
2017-06-01 19:21:01 +08:00
144f2f5310 Fix stack compose bind-mount volumes for Windows
For stack compose files, use filepath.IsAbs instead of path.IsAbs, for
bind-mounted service volumes, because filepath.IsAbs handles Windows
paths, while path.IsAbs does not.

Signed-off-by: John Stephens <johnstep@docker.com>
Upstream-commit: 9043d39dea
Component: cli
2017-05-31 21:13:58 -07:00
4cb2e1a089 Builder: Fix parser directive refactoring
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: c97170d618b7a1f35f47672143bd287666802287
Component: engine
2017-05-31 18:48:27 -07:00
dbc4b6c5bd Do not log the CA config CA signing key in debug mode.
Signed-off-by: Ying Li <ying.li@docker.com>
Upstream-commit: d60f18204978d438d1eb336512576d47991c8ac1
Component: engine
2017-05-31 18:15:33 -07:00
e930dafbb3 Vendoring libnetwork 2e99f06621c23a5f4038968f1af1e28c84e4104e
Fixes #33415
Fixes #33346
Implemented few additional IPVS APIs to be used by other projects

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 0484bdb6ca0ddd0bebc490e335a7f788cdc30f13
Component: engine
2017-05-31 16:04:00 -07:00
472b98cb50 Merge pull request #132 from mavenugo/stack-host
Host and Bridge network support in docker stack deploy
Upstream-commit: efaadcf465
Component: cli
2017-05-31 15:07:56 -07:00
6ff2c18564 Merge pull request #6 from vieux/update_VERSION
update VERSION file
2017-05-31 15:03:04 -07:00
beeb275932 Fix prefix-matching for service ps
The docker CLI matches objects either by ID _prefix_
or a full name match, but not partial name matches.

The correct order of resolution is;

- Full ID match (a name should not be able to mask an ID)
- Full name
- ID-prefix

This patch changes the way services are matched.

Also change to use the first matching service, if there's a
full match (by ID or Name) instead of continue looking for
other possible matches.

Error handling changed;

- Do not error early if multiple services were requested
  and one or more services were not found. Print the
  services that were not found after printing those that
  _were_ found instead
- Print an error if ID-prefix matching is ambiguous

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 6279612443
Component: cli
2017-05-31 21:43:56 +02:00
103f3041e5 Lock container while connecting to a new network.
`ConnectToNetwork` is modfying the container but is not locking the
object.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 4d0888e32bccfd8c0f27a7b66b2a5607d42e2698
Component: engine
2017-05-31 15:13:04 -04:00
61ed140656 Merge pull request #33443 from DeliangFan/fix_download_image_fails
Fix downloading image fails when build docker
Upstream-commit: 555bd548cacfbe02447ebb055d3efa5eeaabe972
Component: engine
2017-05-31 21:03:37 +02:00
733e94a59a Merge pull request #33363 from tonistiigi/fix-chunked-build
Fix cancelling builder on chunked requests
Upstream-commit: 7ea0d1ecc6436063bfc9c72d09a75f15b029ac88
Component: engine
2017-05-31 20:18:35 +02:00
6fa6566523 Merge pull request #33329 from wenjianhn/EINVAL
Don't log EINVAL when unmount IPC
Upstream-commit: 41c3c9cc866d0e310664e2c4cbd42f0df1b88efa
Component: engine
2017-05-31 11:17:19 -07:00
818749ed63 update version
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2017-05-31 11:00:44 -07:00
8e14e925d7 Merge pull request #9 from seemethere/deb_dockerfiles_naming_update
Update deb dockerfiles to $(uname -m) names
Upstream-commit: 10ce75b654208803de1c5ddc7377dae10f943756
Component: packaging
2017-05-31 10:47:58 -07:00
81dbbfda23 Merge component 'cli' from git@github.com:docker/cli master 2017-05-31 16:43:39 +00:00
f4929f012a Change ARCH to be reflective
Signed-off-by: Eli Uriegas <seemethere101@gmail.com>
Upstream-commit: 930db40ec8424555612ce70781e94d5cb172aa4c
Component: packaging
2017-05-31 11:15:19 -05:00
4e36db9541 Rename deb dockerfiles to $(uname -m) equivalents
Signed-off-by: Eli Uriegas <seemethere101@gmail.com>
Upstream-commit: 3f7e423438733fb5f593f666d12714ae2f63fcc9
Component: packaging
2017-05-31 11:14:20 -05:00
66970d08f9 Update GO_VERSION to 1.8.3 (#8)
Signed-off-by: Eli Uriegas <seemethere101@gmail.com>
Upstream-commit: 121e1c478d94a9be5713e944dde113f8637d6e41
Component: packaging
2017-05-31 09:06:42 -07:00
a5b7ff8786 Merge pull request #33305 from thaJeztah/suppress-logger-close-error
Don't log error if file is already closed
Upstream-commit: 316681cd2a644ef7f98fbaf4ca91a45a021b4b22
Component: engine
2017-05-31 17:09:09 +02:00
02dca610a4 Merge pull request #33249 from ripcurld0/env_validate
Add container environment variables correctly to the health check
Upstream-commit: 7c2f20107a0599008152179a18cc8d0323ccc589
Component: engine
2017-05-31 07:35:28 -07:00
421a16553e Increase the Coverage of pkg/platform
Signed-off-by: Raja Sami <raja.sami@tenpearls.com>
Upstream-commit: bdc87676bfee0f9a26fe12323dbe6875af783645
Component: engine
2017-05-31 13:26:40 +05:00
8e156ee521 Don't warn if the shm or mquere is not mounted
Fix #33328

Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
Upstream-commit: cfa2591d3f2636221e5005b3609aeb572e0c6653
Component: engine
2017-05-31 16:19:59 +08:00
6ed8b96066 Fix downloading image fails when build docker
Generate a token for each download process to avoid token expired.

Closes: #33441

Signed-off-by: vanderliang <lansheng@meili-inc.com>
Upstream-commit: cb502cd4e894a78e723902a4d2f23174b69430ce
Component: engine
2017-05-31 14:21:32 +08:00
fe2c9ff86c Don't create source directory while the daemon is being shutdown, fix #30348
If a container mount the socket the daemon is listening on into
container while the daemon is being shutdown, the socket will
not exist on the host, then daemon will assume it's a directory
and create it on the host, this will cause the daemon can't start
next time.

fix issue https://github.com/moby/moby/issues/30348

To reproduce this issue, you can add following code

```
--- a/daemon/oci_linux.go
+++ b/daemon/oci_linux.go
@@ -8,6 +8,7 @@ import (
        "sort"
        "strconv"
        "strings"
+       "time"

        "github.com/Sirupsen/logrus"
        "github.com/docker/docker/container"
@@ -666,7 +667,8 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
        if err := daemon.setupIpcDirs(c); err != nil {
                return nil, err
        }
-
+       fmt.Printf("===please stop the daemon===\n")
+       time.Sleep(time.Second * 2)
        ms, err := daemon.setupMounts(c)
        if err != nil {
                return nil, err

```

step1 run a container which has `--restart always` and `-v /var/run/docker.sock:/sock`
```
$ docker run -ti --restart always -v /var/run/docker.sock:/sock busybox
/ #

```
step2 exit the the container
```
/ # exit
```
and kill the daemon when you see
```
===please stop the daemon===
```
in the daemon log

The daemon can't restart again and fail with `can't create unix socket /var/run/docker.sock: is a directory`.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 7318eba5b2f8bb4b867ca943c3229260ca98a3bc
Component: engine
2017-05-30 22:59:51 -04:00
4c527a90e5 Merge pull request #33387 from cpuguy83/go1.8.3
Bump go to go1.8.3
Upstream-commit: 75e685d620d6a37ec2db87c3c44ca5d918db740c
Component: engine
2017-05-31 02:18:09 +02:00
5c0019b6e8 Merge pull request #129 from dnephin/remove-gox
Remove gox, add support for s390x
Upstream-commit: 6c59636498
Component: cli
2017-05-30 14:05:58 -07:00
ee28c840c7 Remove gox, add support for s390x
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: b7b7d784d8
Component: cli
2017-05-30 16:01:21 -04:00
f2f752196e Check for Windows 10 IoT Core to use process isolation on IoT
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 75f7f2a83a5a6fb276606a2fff4041da9bcd30a3
Component: engine
2017-05-30 12:01:38 -07:00
1369e3364d Merge pull request #33419 from runcom/fix-reaper-containerd
libcontainerd: fix reaper goroutine position
Upstream-commit: 4f55e390c4e5230bad232c462d60f8564faea17f
Component: engine
2017-05-30 10:55:38 -07:00
5146944e21 Merge pull request #118 from cpuguy83/no_prune_volume
Don't prune volumes on `docker system prune`
Upstream-commit: f3cb13c550
Component: cli
2017-05-30 10:21:15 -07:00
f001f628d8 Merge pull request #135 from johnstep/fix_stack_service_configs
Include stack service configs in service specs
Upstream-commit: ebd5191c0e
Component: cli
2017-05-30 13:17:49 -04:00
0a1989cb37 Check signal is unset before using user stopsignal
This fixes an issue where if a stop signal is set, and a user sends
SIGKILL, `container.ExitOnNext()` is not set, thus causing the container
to restart.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 114652ab86609e5c0cbfad84f642942b466a0596
Component: engine
2017-05-30 13:04:36 -04:00
9b30256194 Merge pull request #33360 from aaronlehmann/vendor-swarmkit-7e096ced
Vendor swarmkit 7e096ced
Upstream-commit: 6629f1d0e753edc960f30030299e0e5d48b845aa
Component: engine
2017-05-30 09:59:48 -07:00
a89e29d68b Don't prune volumes on docker system prune
Volumes tend to carry important data and pruning them on `docker system
prune` can easily cause unwanted data loss.

Let's play it safe and not prune volumes on `system prune` by default,
and instead provide an option.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 37fd6128dc
Component: cli
2017-05-30 12:50:30 -04:00
7caa2a586e Merge pull request #134 from johnstep/remove_stack_configs
Remove stack configs on stack removal
Upstream-commit: f573976486
Component: cli
2017-05-30 11:53:54 -04:00
9ac5a90734 Bump go to go1.8.3
Note that go1.8.2 contains a security fix (CVE-2017-8932).

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 0c7c900e9e66335a6bd486be008af43ae83a5a37
Component: engine
2017-05-30 10:15:59 -04:00
c13c5f5760 Merge pull request #33311 from msabansal/dnssearch
Adding support for DNS search on RS1
Upstream-commit: 4bf8714fac11e95e835cf78eb15ba5a518c67c4b
Component: engine
2017-05-30 13:09:18 +02:00
7502b7e1e9 Merge pull request #33411 from vdemeester/move-configdir-away
Move cli.Configdir away (in `flags`).
Upstream-commit: 599f207b45e74648a8a6a7ac87d77e40930504e9
Component: engine
2017-05-30 11:49:40 +02:00
04f354cc94 Merge pull request #33413 from flx42/fix-plugin-retry
Do not reuse a http.Request after a failure in callWithRetry
Upstream-commit: 6f46afd9786f2d09b797ba196f75317f1aab4d1a
Component: engine
2017-05-29 17:30:51 -07:00
58ecec6e8e Move cli.Configdir away (in flags).
This makes integration not depend anymore of `cli` and thus not
require `cobra` and other packages to compile.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 71d60ec0eb7eeddc73d2cf63748ab7debe3f06af
Component: engine
2017-05-29 16:22:33 -07:00
e9185f10cf Don't log error if file is already closed
When closing the log-file, and the file is already
closed, there's no need to log an error.

This patch adds a `closed` boolean to check if the
file was closed, and if so, skip closing the file.
This prevents errors like this being logged:

    level=error msg="Error closing logger: invalid argument"

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 07b51ed300429e88871e40b4d67dc031e2e8901c
Component: engine
2017-05-29 17:42:37 +02:00
bad34014ad Merge pull request #33423 from gesellix/swagger-docs-typo
Fix typo in swagger doc
Upstream-commit: d192db0d9350222d2b8bb6eba8525b04c3be7d61
Component: engine
2017-05-29 15:58:50 +02:00
7acd97d8f9 Merge pull request #33257 from mtesselH/master
Add CreatedAt filed to volume. Display when volume is inspected.
Upstream-commit: 79b19c2e16c43f22187538953f49b2c048b063f8
Component: engine
2017-05-29 10:48:07 +01:00
8329f806d3 Merge pull request #33422 from cpuguy83/dont_unmount_all_the_things
Don't unmount entire plugin manager tree on remove
Upstream-commit: c12becaca72e705b7a52c8a8aeb498db880d0203
Component: engine
2017-05-28 19:25:12 -07:00
db321ad50e add swarm unlock test in client
Signed-off-by: allencloud <allen.sun@daocloud.io>
Upstream-commit: 8ff023fe5a6c33a7d4663978cf57afb2fffba9af
Component: engine
2017-05-29 00:22:24 +08:00
1a6d5b7b4c Fix typo in swagger doc
Signed-off-by: Tobias Gesellchen <tobias@gesellix.de>
Upstream-commit: 56da4f2fb2509f9b2c2bc1c1c609c1dabeaec07d
Component: engine
2017-05-27 22:37:36 +02:00
dd2f64591e Don't unmount entire plugin manager tree on remove
This was mistakenly unmounting everything under `plugins/*` instead of
just `plugins/<id>/*` anytime a plugin is removed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: db5f31732a9868c1e9e4f9a49be70b794ff82d4f
Component: engine
2017-05-27 12:30:37 -04:00
13833c9420 libcontainerd: fix reaper goroutine position
It has observed defunct containerd processes accumulating over
time while dockerd was permanently failing to restart containerd.
Due to a bug in the runContainerdDaemon() function, dockerd does not clean up
its child process if containerd already exits very soon after the (re)start.

The reproducer and analysis below comes from docker 1.12.x but bug
still applies on latest master.

- from libcontainerd/remote_linux.go:

  329 func (r *remote) runContainerdDaemon() error {
   :
   :      // start the containerd child process
   :
  403     if err := cmd.Start(); err != nil {
  404             return err
  405     }
   :
   :      // If containerd exits very soon after (re)start, it is
possible
   :      // that containerd is already in defunct state at the time
when
   :      // dockerd gets here. The setOOMScore() function tries to
write
   :      // to /proc/PID_OF_CONTAINERD/oom_score_adj. However, this
fails
   :      // with errno EINVAL because containerd is defunct. Please see
   :      // snippets of kernel source code and further explanation
below.
   :
  407     if err := setOOMScore(cmd.Process.Pid, r.oomScore); err != nil
{
  408             utils.KillProcess(cmd.Process.Pid)
   :
   :              // Due to the error from write() we return here. As
the
   :              // goroutine that would clean up the child has not
been
   :              // started yet, containerd remains in the defunct
state
   :              // and never gets reaped.
   :
  409             return err
  410     }
   :
  417     go func() {
  418             cmd.Wait()
  419             close(r.daemonWaitCh)
  420     }() // Reap our child when needed
   :
  423 }

This is the kernel function that gets invoked when dockerd tries to
write
to /proc/PID_OF_CONTAINERD/oom_score_adj.

- from fs/proc/base.c:

 1197 static ssize_t oom_score_adj_write(struct file *file, ...
 1198                                         size_t count, loff_t
*ppos)
 1199 {
   :
 1223         task = get_proc_task(file_inode(file));
   :
   :          // The defunct containerd process does not have a virtual
   :          // address space anymore, i.e. task->mm is NULL. Thus the
   :          // following code returns errno EINVAL to dockerd.
   :
 1230         if (!task->mm) {
 1231                 err = -EINVAL;
 1232                 goto err_task_lock;
 1233         }
   :
 1253 err_task_lock:
   :
 1257         return err < 0 ? err : count;
 1258 }

The purpose of the following program is to demonstrate the behavior of
the oom_score_adj_write() function in connection with a defunct process.

$ cat defunct_test.c

\#include <unistd.h>

main()
{
    pid_t pid = fork();

    if (pid == 0)
        // child
        _exit(0);

    // parent
    pause();
}

$ make defunct_test
cc     defunct_test.c   -o defunct_test

$ ./defunct_test &
[1] 3142

$ ps -f | grep defunct_test | grep -v grep
root      3142  2956  0 13:04 pts/0    00:00:00 ./defunct_test
root      3143  3142  0 13:04 pts/0    00:00:00 [defunct_test] <defunct>

$ echo "ps 3143" | crash -s
  PID    PPID  CPU       TASK        ST  %MEM     VSZ    RSS  COMM
  3143   3142   2  ffff880035def300  ZO   0.0       0      0
defunct_test

$ echo "px ((struct task_struct *)0xffff880035def300)->mm" | crash -s
$1 = (struct mm_struct *) 0x0
                          ^^^ task->mm is NULL

$ cat /proc/3143/oom_score_adj
0

$ echo 0 > /proc/3143/oom_score_adj
-bash: echo: write error: Invalid argument"

---

This patch fixes the above issue by making sure we start the reaper
goroutine as soon as possible.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 27087eacbf96e6ef9d48a6d3dc89c7c1cff155b4
Component: engine
2017-05-27 15:13:59 +02:00
94d3fb628e Include stack service configs in service specs
Signed-off-by: John Stephens <johnstep@docker.com>
Upstream-commit: b7cac96f69
Component: cli
2017-05-26 21:41:04 -07:00
8870137e27 Remove stack configs on stack removal
Signed-off-by: John Stephens <johnstep@docker.com>
Upstream-commit: f05cd11ee2
Component: cli
2017-05-26 18:17:43 -07:00
81bb7bdddf Do not reuse a http.Request after a failure in callWithRetry
Closes: #33412

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
Upstream-commit: 62871ef2fa52b0a2e426c30f36d35a9ba1e92fac
Component: engine
2017-05-26 18:02:31 -07:00
332680020c Merge pull request #33409 from alfred-landrum/image-prune-panic
prevent image prune panic
Upstream-commit: bde4c893513f986041dbe43965ae514a2612aed5
Component: engine
2017-05-27 09:37:27 +09:00
a582df93a3 Merge pull request #126 from marcusmartins/handle_empty_registry_info
Handle a Docker daemon without registry info
Upstream-commit: 1b8b63be5c
Component: cli
2017-05-26 15:32:09 -07:00
a9dda5c374 Handle a Docker daemon without registry info
The current implementation of the ElectAuthServer doesn't handle well when the
default Registry server is not included in the response from the daemon Info
endpoint.

That leads to the storage and usage of the credentials for the default registry
(`https://index.docker.io/v1/`) under an empty string on the client config file.

Sample config file after a login via a Docker Daemon without Registry
information:
```json
{
	"auths": {
		"": {
			"auth": "***"
		}
	}
}
```

That can lead to duplication of the password for the default registry and
authentication failures against the default registry if a pull/push is performed
without first authenticating via the misbehaving daemon.

Also, changes the output of the warning message from stdout to sdterr as
per dnephin suggestion.

Signed-off-by: Marcus Martins <marcus@docker.com>
Upstream-commit: 862649707e
Component: cli
2017-05-26 14:46:39 -07:00
c7ff61d425 Add armhf dockerfiles for deb building (#4)
Add armhf dockerfiles for deb building

Signed-off-by: Eli Uriegas <seemethere101@gmail.com>
Upstream-commit: f0c8cea1b79b049743cd1503f7ac4a34c265f476
Component: packaging
2017-05-26 13:10:27 -07:00
71ccf1fe5f Merge pull request #5 from rogaha/add_distro_to_rpms
Add DISTRO/SUITE env. variables to the RPM dockerfiles
Upstream-commit: c259b01e98c4c41526b442ded93aa1cbc83b6294
Component: packaging
2017-05-26 13:02:41 -07:00
f35cfc66e5 prevent image prune panic
Signed-off-by: Alfred Landrum <alfred.landrum@docker.com>
Upstream-commit: 32da2a4234c5c68ff466dc1afc91ba98dbbe199a
Component: engine
2017-05-26 12:54:39 -07:00
dd2cbf777c Add DISTRO/SUITE env. variables to the RPM dockerfiles
Signed-off-by: Roberto Gandolfo Hashioka <roberto_hashioka@hotmail.com>
Upstream-commit: c4a9e41495fac5e4aa72151b80200aa453f65e08
Component: packaging
2017-05-26 11:48:50 -07:00
3d97792442 Add CreatedAt filed to volume. Display when volume is inspected.
Closes #32663 by adding CreatedAt field when volume is created.
Displaying CreatedAt value when volume is inspected
Adding tests to verfiy the new field is correctly populated

Signed-off-by: Marianna <mtesselh@gmail.com>

Moving CreatedAt tests from the CLI

Moving the tests added for the newly added CreatedAt field for Volume, from CLI to API tests

Signed-off-by: Marianna <mtesselh@gmail.com>
Upstream-commit: a46f757c4043031379362c5d6b3bad7562ab9fed
Component: engine
2017-05-26 11:47:02 -07:00
74196507d2 Only set default aliases when the network is user defined.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: d5b505ee8c
Component: cli
2017-05-26 14:25:20 -04:00
f257d783a4 Add tests for verifyExternalNetwork
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 341703d21e
Component: cli
2017-05-26 12:21:04 -04:00
6cac3d13cb With the introduction of node-local network support, docker services can
be attached to special networks such as host and bridge. This fix brings
in the required changes to make sure the stack file accepts these
networks as well.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 123f0bfd98
Component: cli
2017-05-25 19:50:08 -07:00
933e100f5e Merge pull request #33384 from Microsoft/jjh/sandboxpath
Windows: Remove unused SandboxPath
Upstream-commit: e925820bfd5af066497800a02c597d6846988398
Component: engine
2017-05-25 11:21:15 -07:00
1fc413c063 Merge pull request #33320 from sbko/33138-generic-api-error-messages
Stop referring CLI flags in error messages if API client is unknown
Upstream-commit: a2f3f6660d08dfb667f091e0fd8454c815dd1c81
Component: engine
2017-05-25 10:48:29 -07:00
4b25f2f51d Merge pull request #33061 from dnephin/refactor-builder-probe-cache
[Builder] Refactor builder probe cache and container backend
Upstream-commit: 8d20641d43a05ee04dad0818ac51d5319a8e5e30
Component: engine
2017-05-25 10:10:49 -07:00
292fba1b59 Fix when containerd restarted, event handler may exit
Description:
Kill docker-containerd continuously, and use kill -SIGUSR1 <dockerpid>
to check docker callstacks. And we will find that event
handler: startEventsMonitor or handleEventStream will exit.

This will only happen when system is busy, containerd need more time to
startup, and the monitor gorotine maybe exit.

Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
Upstream-commit: 02ce73f62e73e78a4ec29b29fb2ba552221fe885
Component: engine
2017-05-25 17:32:05 +08:00
cbcb1aca45 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-05-25 05:58:35 +00:00
680164099a pass in git commit override when building deb
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: 3c70b56937c415c6bf3516aeaa5231c6d7d3145d
Component: packaging
2017-05-25 05:57:29 +00:00
a88dc6ffda override ver and git commit when building all deb pkgs
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: 4397990e00863254d78c44fbe904a70272b5b340
Component: packaging
2017-05-25 05:22:42 +00:00
6a7791114d Merge pull request #33292 from keloyang/attach-restart-check
Add a restarting check to ContainerAttach
Upstream-commit: da3c3ec1458588d5d263dc3babd3dca95fdc7d8d
Component: engine
2017-05-24 18:30:05 -07:00
cefc7ca79a Merge component 'cli' from git@github.com:docker/cli master 2017-05-24 23:00:04 +00:00
a32935ea52 Merge pull request #127 from andrewhsu/gitcommit
allow override of git hash when building binary
Upstream-commit: 11e7d35f9c
Component: cli
2017-05-24 15:57:02 -07:00
9cdca5ef2e pass in optional GITCOMMIT override
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: 446af3a9b7
Component: cli
2017-05-24 22:45:42 +00:00
cfc2b7a626 Merge pull request #33365 from darrenstahlmsft/revendorGowinio
Update go-winio to v0.4.2
Upstream-commit: c22ad736aa2eb2b796cd9a662017e66b1cf970e0
Component: engine
2017-05-24 22:08:59 +01:00
be30b971d7 Windows: Remove unused SandboxPath
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 2f038c25868727310992104b7b267fed6c7dad39
Component: engine
2017-05-24 13:44:35 -07:00
553a2e157c Merge pull request #33376 from nhorman/keepalive
Ensure that a device mapper task is referenced until task is complete
Upstream-commit: e4abe7c2ce9bb496f12adbd6e00713e776fd1807
Component: engine
2017-05-24 15:57:04 -04:00
65da2e84f0 Merge pull request #33358 from vdemeester/fix-integration-request-package
Fix `request.SockRequestRaw` error check
Upstream-commit: ffd3d6ccd92312fe15e080c0267d0f9bdfe90bd4
Component: engine
2017-05-24 11:49:34 -07:00
af8a181696 Merge pull request #33095 from chrisdias/chrisdias/multistagebuild
syntax highlighting: support FROM...AS for multi stage build
Upstream-commit: 08894a7f237945c70ffc1790f5c297a416f85e87
Component: engine
2017-05-24 11:35:17 -07:00
6a563fa217 Merge pull request #2 from seemethere/fix_hash_files_target
Make the hash_files target non interactive
Upstream-commit: 1e779c6848a4f796d8b2a12b64c7a85183180b19
Component: packaging
2017-05-24 10:15:43 -07:00
92d664086d Make the hash_files target non interactive
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 097516fc76a2c9acf798dc523326904520ff1fc7
Component: packaging
2017-05-24 10:11:40 -07:00
c4ff71019e Merge pull request #33167 from utzb/rpmbuilds
adding rpm builds for ppc64le and s390x
Upstream-commit: 4050e3061ceaeeb6644e1a6fa33a69e81afba4c6
Component: engine
2017-05-24 17:24:23 +01:00
75a4055d7c Ensure that a device mapper task is referenced until task is complete
DeviceMapper tasks in go use SetFinalizer to clean up C construct
counterparts in the C LVM library.  While thats well and good, it relies
heavily on the exact interpretation of when the golang garbage collector
determines that an object is unreachable is subject to reclaimation.
While common sense would assert that for stack variables (which these DM
tasks always are), are unreachable when the stack frame in which they
are declared returns, thats not the case.  According to this:

https://golang.org/pkg/runtime/#SetFinalizer

The garbage collector decides that, if a function calls into a
systemcall (which task.run() always will in LVM), and there are no
subsequent references to the task variable within that stack frame, then
it can be reclaimed.  Those conditions are met in several devmapper.go
routines, and if the garbage collector runs in the middle of a
deviceMapper operation, then the task can be destroyed while the
operation is in progress, leading to crashes, failed operations and
other unpredictable behavior.

The fix is to use the KeepAlive interface:

https://golang.org/pkg/runtime/#KeepAlive

The KeepAlive method is effectively an empy reference that fools the
garbage collector into thinking that a variable is still reachable.  By
adding a call to KeepAlive in the task.run() method, we can ensure that
the garbage collector won't reclaim a task object until its execution
within the deviceMapper C library is complete.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Upstream-commit: d764d8b16624e4924b3949273089f851efa0f717
Component: engine
2017-05-24 11:11:23 -04:00
d1013c3e75 Merge pull request #102 from keloyang/attach-block
Recheck the container's state to avoid attach block.
Upstream-commit: 61c0b9f78d
Component: cli
2017-05-24 12:09:38 +01:00
05027a4b96 Update go-winio to v0.4.2
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 3f13107223a9753d709c196c46f1c846041fc0c3
Component: engine
2017-05-23 18:27:50 -07:00
e549564e77 Fix cancelling builder on chunked requests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 23628bd7efb0aae565cea5ee040e373b0c93fd8d
Component: engine
2017-05-23 16:29:13 -07:00
f36cffe0bd cluster: Only pass a join address when in the process of joining a cluster
This code currently passes a random manager address when creating a new
Node. This doesn't really make sense - we should only pass a join
address on the initial join, or when retrying that join. An upcoming
change to swarmkit will pay attention to JoinAddr significant when a
node is already part of a cluster, so passing in the random value needs
to be avoided.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 24477e70040019ca421ec1031dc553dc780c02f1
Component: engine
2017-05-23 15:03:56 -07:00
5556f64d13 Vendor swarmkit 7e096ced
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 10df99f9ae48acc9888494223256637a8ca06f50
Component: engine
2017-05-23 15:01:35 -07:00
bdc8240507 Fix request.SockRequestRaw error check
We should check for error before reading the response (response can be
nil, and thus this would panic)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 45e0376ea361811b2f5d0653a6b103dd39653371
Component: engine
2017-05-23 12:48:22 -07:00
850d525b5f Extract imageProber and ContainerBackend from Builder
Extract a common function for builder.createContainer
Extract imageCache for doing cache probes
Removes the cacheBuested field from Builder
Create a new containerManager class which reduces the interface between the
builder and managing containers to 3 functions (from 6)

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 19f3b0715cf89f336efa286ea1d3f8b57d8c4973
Component: engine
2017-05-23 15:12:58 -04:00
c70c1ec6df Merge pull request #33341 from cyli/do-not-clear-state-on-swarm-init-join
Do not clear swarm directory on `swarm init` and `swarm join`
Upstream-commit: a9fcaee3514c60d997044b246e4c06e9ba80f4f5
Component: engine
2017-05-23 12:09:53 -07:00
f1ece28775 Update go-winio to v0.4.1
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 5981675d5f
Component: cli
2017-05-23 11:11:43 -07:00
79087a0823 Merge pull request #109 from vdemeester/codecov-in-circle
Add test-coverage & codecov target and update circleci
Upstream-commit: e47cc91ac9
Component: cli
2017-05-23 11:59:05 -04:00
783c8c542c just docker ce
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-05-23 04:49:57 +00:00
5e0e51d4b4 added issues section
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
2017-05-23 04:37:33 +00:00
d097d03226 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-05-23 03:30:17 +00:00
b602250a48 more doc cleanup
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: dafbbb4fa4fbaade4ae0a6abcba39bbfcd8f755d
Component: packaging
2017-05-23 03:19:52 +00:00
afb05b3e5d Merge pull request #119 from andrewhsu/ver
allow version number to be set in builds
Upstream-commit: 28eb46de56
Component: cli
2017-05-22 18:16:41 -07:00
93de81213c Support FROM...AS syntax for multi stage build dockerfiles
Signed-off-by: chrisdias <cdias@microsoft.com>
Upstream-commit: 8523e9d108a0e98865673701a7bd0a7929c5260b
Component: engine
2017-05-22 18:12:10 -07:00
7c3373349d Merge pull request #33342 from aaronlehmann/cred-helpers-vendor
vendor: Remove docker-credential-helpers
Upstream-commit: b3d19cfc6a0184feb814734716fa2fda415f4623
Component: engine
2017-05-22 21:08:16 -04:00
90e101ed15 Do not clear swarm directory at the begining of swarm init and swarm join now.
However, do clear the directory if init or join fails, because we don't
want to leave it in a half-finished state.

Signed-off-by: Ying Li <ying.li@docker.com>
Upstream-commit: bf3e9293a66c77a2fddf4e691222898846b4af9f
Component: engine
2017-05-22 17:45:20 -07:00
cc72dd2445 Stop referring CLI flags in error messages if API client is unknown
Signed-off-by: Stanislav Bondarenko <stanislav.bondarenko@gmail.com>
Upstream-commit: 92291a7355dff35be70b5d0ebf634f0232ca6a94
Component: engine
2017-05-22 18:50:49 -04:00
a27d8b8afb Merge pull request #1 from seemethere/add_file_hashing
Add file hashing for static files
Upstream-commit: 48d4119a0bdb61639214a971360490e8a4fbe025
Component: packaging
2017-05-22 15:41:10 -07:00
fe481b52a5 Move the hashing of files to its own target
So we can use it at will

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: 533a843393bd7c3674074ec9af73c8e666fc7484
Component: packaging
2017-05-22 15:11:53 -07:00
630485f440 Add builder dev report for 2017-05-22
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: c07d8fc3be3ad6007f54f80c5e986d7dde2dc882
Component: engine
2017-05-22 15:00:50 -07:00
b3cf695357 Add file hashing for static files
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
Upstream-commit: a1b7f6f3407546ff41ed2e0d16d7e1b2a8ac0ef4
Component: packaging
2017-05-22 14:43:24 -07:00
949950950a vendor: Remove docker-credential-helpers
This appears to be a remnant from the CLI that is no longer imported
anywhere. Remove it from vendor.conf and the vendor directory.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: aa6fc939baf0bae00391a0ba703187018055b8bf
Component: engine
2017-05-22 13:58:28 -07:00
d64468f256 Merge pull request #33279 from nishanttotla/fix-service-image-issues
Ensure service images get default tag and print familiar strings
Upstream-commit: 5648a1ada223d692615072af26d0ce6e23415006
Component: engine
2017-05-22 21:45:11 +01:00
1d9c61db3a allow version number to be set in builds
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: 3dfe334a7a
Component: cli
2017-05-22 13:22:42 -07:00
b936f95f25 Merge component 'packaging' from git@github.com:docker/docker-ce-packaging master 2017-05-22 19:51:06 +00:00
141bcdee33 specific version numbers for ubuntu
Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
Upstream-commit: c4e3bb1768ff6f6285e65ca88436aa7de5b89bc8
Component: packaging
2017-05-22 19:48:10 +00:00
7813ee64ef Merge pull request #33310 from darrenstahlmsft/RevendorGowinio
Revendor go-winio to v0.4.1
Upstream-commit: 65f360fc415a5ef648250a76ca261c2ae529467a
Component: engine
2017-05-22 10:31:57 -07:00
3dea3b7a46 Merge pull request #32774 from darrenstahlmsft/ProcessorMaximum
Use CpuMaximum instead of CpuPercent for more precision
Upstream-commit: bb64d45be1dce3fe1a526b2362a7d8451bfdcbe3
Component: engine
2017-05-22 08:55:17 -07:00
45dcc1512b Merge pull request #33253 from dave-tucker/clientHost
client: Expose ClientHost to client users
Upstream-commit: ab2abb0d940476fcb56d2ee565afdf1bc4d525d4
Component: engine
2017-05-22 16:27:43 +01:00
4a211248b9 client: Expose DaemonHost to client users
This commit exposes `Client.host` as `Client.DaemonHost()`
This allows users of the client, a CLI for example, to query the Host
that the client is attempting to contact and vary their behaviour
accordingly. For example, to allow client-side configuration of
HTTP proxy settings for a number of different docker hosts.

Signed-off-by: Dave Tucker <dt@docker.com>
Upstream-commit: 6ce6ae1cd11d888e0c8ede20926b86981cee5ce1
Component: engine
2017-05-22 13:25:11 +01:00
38cfa2ee6d Spelling fixes
* appropriate
* assumption
* attach
* because
* building
* customized
* mapping
* propagated

Signed-off-by: Josh Soref <jsoref@gmail.com>
Upstream-commit: 70a9905ee5
Component: cli
2017-05-22 01:39:06 +00:00
a5644c91a3 Add container environment variables correctly to the health check
The health check process doesn't have all the environment
varialbes in the container or has them set incorrectly.

This patch should fix that problem.

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Upstream-commit: 5836d86ac4d617e837d94010aa60384648ab59ea
Component: engine
2017-05-21 21:39:00 +03:00
52f875b0b8 Merge pull request #33307 from dongluochen/swarm_event_test
Event tests need retry logic
Upstream-commit: 916e9ad75472bb5a0ab7acf9515a4d369248791d
Component: engine
2017-05-20 15:48:50 +02:00
d150808e81 Add a restarting check to ContainerAttach
Signed-off-by: yangshukui <yangshukui@huawei.com>
Upstream-commit: 5010e09534c4595ea4bc3f53a415626fc9e9d3b1
Component: engine
2017-05-20 11:27:45 +08:00
cb8736d49e Merge pull request #33308 from ehazlett/remove-runtime-data
Remove RuntimeData from cluster and types
Upstream-commit: a40595d498f6e2c58ae539e130d81d00143b0a76
Component: engine
2017-05-20 02:05:06 +02:00
1959f587f4 Recheck the container's state to avoid attach block.
If use docker attach command to attach to a stop container, it will return
"You cannot attach to a stopped container" error, it's ok, but when
attach to a running container, it(docker attach) use inspect to check
the container's state, if it pass the state check on the client side,
and then the container is stopped, docker attach command still attach to
the container and not exit.

Signed-off-by: Shukui Yang <yangshukui@huawei.com>
Upstream-commit: f9dc3337f9
Component: cli
2017-05-20 08:02:06 +08:00
bce5af578c Revendor go-winio to v0.4.1
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: af7d8d09ef2dde07c9c0004a14e3a28c93007458
Component: engine
2017-05-19 16:13:52 -07:00
f039c950a8 Upload coverage report from outside of test container.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: f6d148c632
Component: cli
2017-05-19 17:37:38 -04:00
56d05cc358 Add test-coverage & codecov target and update circleci
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: d79d903864
Component: cli
2017-05-19 17:22:37 -04:00
c9ec562bee remove RuntimeData from cluster and types
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
Upstream-commit: 8eeba751983d6499a07fcd21c26f381eb1d17d19
Component: engine
2017-05-19 17:10:32 -04:00
5bbf4871d4 Merge pull request #106 from dnephin/improve-makefile
Remove @ from Makefiles
Upstream-commit: 883d28cfce
Component: cli
2017-05-19 16:03:04 -04:00
f1ce9152c0 Use CpuMaximum instead of CpuPercent for more precision
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: 425973cbb87aef6a32b225a57f5ef2d78d5749d5
Component: engine
2017-05-19 12:33:14 -07:00
1f14cbbc58 Revendor runtime-spec
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: b90f294c1cf0dd2bc3f139cd8f339da79595a0bb
Component: engine
2017-05-19 12:33:14 -07:00
caad7b9331 Event tests need to wait for events
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
Upstream-commit: 59b2d0473af5155bb31adcc17bc36857ebd13a15
Component: engine
2017-05-19 12:14:50 -07:00
8d6081fcd1 Adding unit tests for pin by digest (client)
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: 75c7536d2e2e328b644bf69153de879d1d197988
Component: engine
2017-05-19 10:48:12 -07:00
93bcab0aa8 Ensure service images get default tag and print familiar strings
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
Upstream-commit: 5efcec77170dd6c4087d4f1fb3695c32d94edfb4
Component: engine
2017-05-19 10:35:34 -07:00
0de3b92ebd Merge pull request #104 from dnephin/add-ppc64le-to-cross
Add ppc64le to cross
Upstream-commit: 1fc7eb5d64
Component: cli
2017-05-19 08:02:01 -07:00
b1f02f908e Make TestLogsAPIStdout a bit less racey
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 960b8d9294356b5651938244a62e0d485da72211
Component: engine
2017-05-19 10:17:54 -04:00
b1680367c9 Adding support for DNS search on RS1
Signed-off-by: Sandeep Bansal <sabansal@microsoft.com>
Upstream-commit: b8e8dcd6e031d005a2d46d95f84da35b436cd870
Component: engine
2017-05-18 19:41:06 -07:00
4d54b44919 Enabled linux/ppc64le cross build.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 46049dd0b6
Component: cli
2017-05-18 13:07:26 -04:00
bc98a48832 Merge pull request #77 from vdemeester/move-duration-opts
Move duration opts into an opts package
Upstream-commit: eea4a38cd6
Component: cli
2017-05-18 11:15:30 +02:00
235c74487c Remove @ from Makefiles.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 73ebb07df5
Component: cli
2017-05-17 15:56:19 -04:00
829eef48ba Move duration opts into an opts package
They have nothing to do with service and could be used on their own.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: b5182ba17f
Component: cli
2017-05-16 17:49:40 +02:00
bbf5e9962e GCP Logs: send log line as jsonPayload.message instead of jsonPayload.data
Signed-off-by: gkze <george@bugsnag.com>
Upstream-commit: d42c268fc3983d19e9dbd800948e7c4445c425f0
Component: engine
2017-05-15 16:35:53 -07:00
a2a647ff42 adding rpm builds for ppc64le and s390x
Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Signed-off-by: Dominik Dingel <dingel@de.ibm.com>
Signed-off-by: Thorsten Winkler <thorsten.winkler@de.ibm.com>
Signed-off-by: Utz Bacher <utz.bacher@de.ibm.com>
Upstream-commit: 539e976aa9d5c6ffd25904ed961210628ff31c60
Component: engine
2017-05-12 01:26:55 +02:00
957a7e39a2 pkg: remove random package
The unnecessary `random` package has been removed in favor of using the
`math/rand` package directly. Seeding of the random value from crypto
has been added to the `stringid` package to account for the change.

May need to add an equivalent seed to `namesgenerator`, but this is
often used with `stringid` and has collision protection.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 66cfe61f71252f528ddb458d554cd241e996d9f1
Component: engine
2017-05-08 17:02:02 -07:00
6dce6bba77 Enable inspect exec if container is pause/restarting/non-running
if docker exec exit and at the same the the container is pause,
there could be a chance the `docker exec exit` will fail
```
$ docker exec -ti 388c7f47a06c sh
/ # exit
Error response from daemon: Container 388c7f47a06cce0856266ffd56a2ce2901689ca7a6b9cd741b37652418448f2b is paused, unpause the container before exec
```
To reproduce this error easilly, we can add a sleep in `containerPause`
```
--- a/daemon/pause.go
+++ b/daemon/pause.go
@@ -2,6 +2,7 @@ package daemon

 import (
        "fmt"
+       "time"

        "github.com/docker/docker/container"
 )
@@ -25,7 +26,7 @@ func (daemon *Daemon) ContainerPause(name string) error {
 func (daemon *Daemon) containerPause(container *container.Container) error {
        container.Lock()
        defer container.Unlock()
-
+       time.Sleep(time.Second * 5)
        // We cannot Pause the container which is not running
        if !container.Running {
                return errNotRunning{container.ID}
```

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: 0e87588bbb2482f9635a19ac43be1c0ee9652ac2
Component: engine
2017-04-28 05:52:15 -04:00
bde265f61b devicemapper: remove thin pool if 'initDevmapper' failed
if initDevmapper failed after creating thin-pool, the thin-pool will not be removed,
this would cause we can't use the same lvm to create another thin-pool.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: ea22d7ab91e7febc69433b979160dda8a79ad46e
Component: engine
2017-04-10 13:11:39 -04:00
a01023929b Fix behavior of absolute paths in .dockerignore
According to documentation (https://docs.docker.com/engine/reference/builder/#dockerignore-file), absolute paths like `/foo/bar` should have the same effect as `foo/bar`. This is not the case today.

This fix normalize paths when reading the .dockerignore file by removing
leading slashes.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
Upstream-commit: 1cde87c43abd100f4233e965e040e30a6bd34112
Component: engine
2017-03-31 10:43:59 +02:00
1526 changed files with 88093 additions and 53656 deletions

View File

@ -5,83 +5,70 @@ information on the list of deprecated flags and APIs please have a look at
https://docs.docker.com/engine/deprecated/ where target removal dates can also
be found.
## 17.06.2-ce (2017-09-05)
## 17.07.0-ce (2017-08-29)
### Client
### API & Client
- Enable TCP keepalive in the client to prevent loss of connection [docker/cli#415](https://github.com/docker/cli/pull/415)
### Runtime
- Devmapper: ensure UdevWait is called after calls to setCookie [moby/moby#33732](https://github.com/moby/moby/pull/33732)
- Aufs: ensure diff layers are correctly removed to prevent leftover files from using up storage [moby/moby#34587](https://github.com/moby/moby/pull/34587)
### Swarm mode
- Ignore PullOptions for running tasks [docker/swarmkit#2351](https://github.com/docker/swarmkit/pull/2351)
## 17.06.1-ce (2017-08-17)
* Add support for proxy configuration in config.json [docker/cli#93](https://github.com/docker/cli/pull/93)
* Enable pprof/debug endpoints by default [moby/moby#32453](https://github.com/moby/moby/pull/32453)
* Passwords can now be passed using `STDIN` using the new `--password-stdin` flag on `docker login` [docker/cli#271](https://github.com/docker/cli/pull/271)
+ Add `--detach` to docker scale [docker/cli#243](https://github.com/docker/cli/pull/243)
* Prevent `docker logs --no-stream` from hanging due to non-existing containers [moby/moby#34004](https://github.com/moby/moby/pull/34004)
- Fix `docker stack ps` printing error to `stdout` instead of `stderr` [docker/cli#298](https://github.com/docker/cli/pull/298)
* Fix progress bar being stuck on `docker service create` if an error occurs during deploy [docker/cli#259](https://github.com/docker/cli/pull/259)
* Improve presentation of progress bars in interactive mode [docker/cli#260](https://github.com/docker/cli/pull/260) [docker/cli#237](https://github.com/docker/cli/pull/237)
* Print a warning if `docker login --password` is used, and recommend `--password-stdin` [docker/cli#270](https://github.com/docker/cli/pull/270)
* Make API version negotiation more robust [moby/moby#33827](https://github.com/moby/moby/pull/33827)
* Hide `--detach` when connected to daemons older than Docker 17.05 [docker/cli#219](https://github.com/docker/cli/pull/219)
+ Add `scope` filter in `GET /networks/(id or name)` [moby/moby#33630](https://github.com/moby/moby/pull/33630)
### Builder
* Fix a regression, where `ADD` from remote URL's extracted archives [#89](https://github.com/docker/docker-ce/pull/89)
* Fix handling of remote "git@" notation [#100](https://github.com/docker/docker-ce/pull/100)
* Fix copy `--from` conflict with force pull [#86](https://github.com/docker/docker-ce/pull/86)
### Client
* Make pruning volumes optional when running `docker system prune`, and add a `--volumes` flag [#109](https://github.com/docker/docker-ce/pull/109)
* Show progress of replicated tasks before they are assigned [#97](https://github.com/docker/docker-ce/pull/97)
* Fix `docker wait` hanging if the container does not exist [#106](https://github.com/docker/docker-ce/pull/106)
* If `docker swarm ca` is called without the `--rotate` flag, warn if other flags are passed [#110](https://github.com/docker/docker-ce/pull/110)
* Fix API version negotiation not working if the daemon returns an error [#115](https://github.com/docker/docker-ce/pull/115)
* Print an error if "until" filter is combined with "--volumes" on system prune [#154](https://github.com/docker/docker-ce/pull/154)
* Implement long running interactive session and sending build context incrementally [moby/moby#32677](https://github.com/moby/moby/pull/32677) [docker/cli#231](https://github.com/docker/cli/pull/231) [moby/moby#33859](https://github.com/moby/moby/pull/33859)
* Warn on empty continuation lines [moby/moby#33719](https://github.com/moby/moby/pull/33719)
- Fix `.dockerignore` entries with a leading `/` not matching anything [moby/moby#32088](https://github.com/moby/moby/pull/32088)
### Logging
* Fix stderr logging for journald and syslog [#95](https://github.com/docker/docker-ce/pull/95)
* Fix log readers can block writes indefinitely [#98](https://github.com/docker/docker-ce/pull/98)
* Fix awslogs driver repeating last event [#151](https://github.com/docker/docker-ce/pull/151)
### Networking
* Fixed issue with driver options not received by network drivers [#127](https://github.com/docker/docker-ce/pull/127)
* Fixed issue with overlay network IP address reuse [#197](https://github.com/docker/docker-ce/pull/197)
### Plugins
* Make plugin removes more resilient to failure [#91](https://github.com/docker/docker-ce/pull/91)
- Fix wrong filemode for rotate log files [moby/moby#33926](https://github.com/moby/moby/pull/33926)
- Fix stderr logging for journald and syslog [moby/moby#33832](https://github.com/moby/moby/pull/33832)
### Runtime
* Prevent a goroutine leak when healthcheck gets stopped [#90](https://github.com/docker/docker-ce/pull/90)
* Do not error on relabel when relabel not supported [#92](https://github.com/docker/docker-ce/pull/92)
* Limit max backoff delay to 2 seconds for GRPC connection [#94](https://github.com/docker/docker-ce/pull/94)
* Fix issue preventing containers to run when memory cgroup was specified due to bug in certain kernels [#102](https://github.com/docker/docker-ce/pull/102)
* Fix container not responding to SIGKILL when paused [#102](https://github.com/docker/docker-ce/pull/102)
* Improve error message if an image for an incompatible OS is loaded [#108](https://github.com/docker/docker-ce/pull/108)
* Fix a handle leak in go-winio [#112](https://github.com/docker/docker-ce/pull/112)
* Fix issue upon upgrade, preventing docker from showing running containers when `--live-restore` is enabled [#117](https://github.com/docker/docker-ce/pull/117)
* Fix bug where services using secrets would fail to start on daemons using the `userns-remap` feature [#121](https://github.com/docker/docker-ce/pull/121)
* Fix error handling with not-exist errors on remove [#142](https://github.com/docker/docker-ce/pull/142)
* Fix REST API Swagger representation cannot be loaded with SwaggerUI [#156](https://github.com/docker/docker-ce/pull/156)
### Security
* Redact secret data on "secret create" [#99](https://github.com/docker/docker-ce/pull/99)
* Allow stopping of paused container [moby/moby#34027](https://github.com/moby/moby/pull/34027)
+ Add quota support for the overlay2 storage driver [moby/moby#32977](https://github.com/moby/moby/pull/32977)
* Remove container locks on `docker ps` [moby/moby#31273](https://github.com/moby/moby/pull/31273)
* Store container names in memdb [moby/moby#33886](https://github.com/moby/moby/pull/33886)
* Fix race condition between `docker exec` and `docker pause` [moby/moby#32881](https://github.com/moby/moby/pull/32881)
* Devicemapper: Rework logging and add `--storage-opt dm.libdm_log_level` [moby/moby#33845](https://github.com/moby/moby/pull/33845)
* Devicemapper: Prevent "device in use" errors if deferred removal is enabled, but not deferred deletion [moby/moby#33877](https://github.com/moby/moby/pull/33877)
* Devicemapper: Use KeepAlive to prevent tasks being garbage-collected while still in use [moby/moby#33376](https://github.com/moby/moby/pull/33376)
* Report inetermediate prune results if prune is cancelled [moby/moby#33979](https://github.com/moby/moby/pull/33979)
- Fix run `docker rename <container-id> new_name` concurrently resulting in the having multiple names [moby/moby#33940](https://github.com/moby/moby/pull/33940)
* Fix file-descriptor leak and error handling [moby/moby#33713](https://github.com/moby/moby/pull/33713)
- Fix SIGSEGV when running containers [docker/cli#303](https://github.com/docker/cli/pull/303)
* Prevent a goroutine leak when healthcheck gets stopped [moby/moby#33781](https://github.com/moby/moby/pull/33781)
* Image: Improve store locking [moby/moby#33755](https://github.com/moby/moby/pull/33755)
* Fix Btrfs quota groups not being removed when container is destroyed [moby/moby#29427](https://github.com/moby/moby/pull/29427)
* Libcontainerd: fix defunct containerd processes not being properly reaped [moby/moby#33419](https://github.com/moby/moby/pull/33419)
* Preparations for Linux Containers on Windows
* LCOW: Dedicated scratch space for service VM utilities [moby/moby#33809](https://github.com/moby/moby/pull/33809)
* LCOW: Support most operations excluding remote filesystem [moby/moby#33241](https://github.com/moby/moby/pull/33241) [moby/moby#33826](https://github.com/moby/moby/pull/33826)
* LCOW: Change directory from lcow to "Linux Containers" [moby/moby#33835](https://github.com/moby/moby/pull/33835)
* LCOW: pass command arguments without extra quoting [moby/moby#33815](https://github.com/moby/moby/pull/33815)
* LCOW: Updates necessary due to platform schema change [moby/moby#33785](https://github.com/moby/moby/pull/33785)
- Aufs: ensure diff layers are correctly removed to prevent leftover files from using up storage [moby/moby#34587](https://github.com/moby/moby/pull/34587)
### Swarm Mode
* Do not add duplicate platform information to service spec [#107](https://github.com/docker/docker-ce/pull/107)
* Cluster update and memory issue fixes [#114](https://github.com/docker/docker-ce/pull/114)
* Changing get network request to return predefined network in swarm [#150](https://github.com/docker/docker-ce/pull/150)
* Initial support for plugable secret backends [moby/moby#34157](https://github.com/moby/moby/pull/34157) [moby/moby#34123](https://github.com/moby/moby/pull/34123)
* Sort swarm stacks and nodes using natural sorting [docker/cli#315](https://github.com/docker/cli/pull/315)
* Make engine support cluster config event [moby/moby#34032](https://github.com/moby/moby/pull/34032)
* Only pass a join address when in the process of joining a cluster [moby/moby#33361](https://github.com/moby/moby/pull/33361)
* Fix error during service creation if a network with the same name exists both as "local" and "swarm" scoped network [docker/cli#184](https://github.com/docker/cli/pull/184)
* (experimental) Add support for plugins on swarm [moby/moby#33575](https://github.com/moby/moby/pull/33575)
## 17.06.0-ce (2017-06-19)
**NOTE**: Docker 17.06 by default disables communication with legacy (v1) registries. If you
require interaction with registries that have not yet migrated to the v2 protocol, set the
`--disable-legacy-registry=false` daemon option. Interaction with v1 registries will be removed
in Docker 17.12.
## 17.06.0-ce (2017-06-07)
### Builder
@ -101,11 +88,6 @@ in Docker 17.12.
+ Add new `ca ` subcommand to `docker swarm` to allow managing a swarm CA [#docker/cli/48](https://github.com/docker/cli/pull/48)
+ Add credential-spec to compose [#docker/cli/71](https://github.com/docker/cli/pull/71)
+ Add support for csv format options to `--network` and `--network-add` [#docker/cli/62](https://github.com/docker/cli/pull/62) [#33130](https://github.com/moby/moby/pull/33130)
- Fix stack compose bind-mount volumes on Windows [#docker/cli/136](https://github.com/docker/cli/pull/136)
- Correctly handle a Docker daemon without registry info [#docker/cli/126](https://github.com/docker/cli/pull/126)
+ Allow --detach and --quiet flags when using --rollback [#docker/cli/144](https://github.com/docker/cli/pull/144)
+ Remove deprecated `--email` flag from `docker login` [#docker/cli/143](https://github.com/docker/cli/pull/143)
* Adjusted `docker stats` memory output [#docker/cli/80](https://github.com/docker/cli/pull/80)
### Distribution
@ -121,8 +103,6 @@ in Docker 17.12.
+ Add Support swarm-mode services with node-local networks such as macvlan, ipvlan, bridge, host [#32981](https://github.com/moby/moby/pull/32981)
+ Pass driver-options to network drivers on service creation [#32981] (https://github.com/moby/moby/pull/33130)
+ Isolate Swarm Control-plane traffic from Application data traffic using --data-path-addr [#32717] (https://github.com/moby/moby/pull/32717)
* Several improvments to Service Discovery [#docker/libnetwork/1796](https://github.com/docker/libnetwork/pull/1796)
* Add DOCKER-USER chain enabling user customization of iptables FORWARD policy [#docker/libnetwork/1675](https://github.com/docker/libnetwork/pull/1675)
### Packaging
@ -142,14 +122,6 @@ in Docker 17.12.
+ Add daemon option to allow pushing foreign layers [#33151](https://github.com/moby/moby/pull/33151)
- Fix an issue preventing containerd to be restarted after it died [#32986](https://github.com/moby/moby/pull/32986)
+ Add cluster events to Docker event stream. [#32421](https://github.com/moby/moby/pull/32421)
+ Add support for DNS search on windows [#33311](https://github.com/moby/moby/pull/33311)
* Upgrade to Go 1.8.3 [#33387](https://github.com/moby/moby/pull/33387)
- Prevent a containerd crash when journald is restarted [#containerd/930](https://github.com/containerd/containerd/pull/930)
- Fix healthcheck failures due to invalid environment variables [#33249](https://github.com/moby/moby/pull/33249)
- Prevent a directory to be created in lieu of the daemon socket when a container mounting it is to be restarted during a shutdown [#30348](https://github.com/moby/moby/pull/33330)
- Prevent a container to be restarted upon stop if its stop signal is set to `SIGKILL` [#33335](https://github.com/moby/moby/pull/33335)
- Ensure log drivers get passed the same filename to both StartLogging and StopLogging endpoints [#33583](https://github.com/moby/moby/pull/33583)
- Remove daemon data structure dump on `SIGUSR1` to avoid a panic [#33598](https://github.com/moby/moby/pull/33598)
### Security
@ -165,14 +137,6 @@ in Docker 17.12.
+ Add API to rotate swarm CA certificate [#32993](https://github.com/moby/moby/pull/32993)
* Service digest pining is now handled client side [#32388](https://github.com/moby/moby/pull/32388), [#33239](https://github.com/moby/moby/pull/33239)
+ Placement now also take platform in account [#33144](https://github.com/moby/moby/pull/33144)
- Fix possible hang when joining fails [#docker-ce/19](https://github.com/docker/docker-ce/pull/19)
- Fix an issue preventing external CA to be accepted [#33341](https://github.com/moby/moby/pull/33341)
- Fix possible orchestration panic in mixed version clusters [#swarmkit/2233](https://github.com/docker/swarmkit/pull/2233)
- Avoid assigning duplicate IPs during initialization [#swarmkit/2237](https://github.com/docker/swarmkit/pull/2237)
### Deprecation
* Disable legacy registry (v1) by default [#33629](https://github.com/moby/moby/pull/33629)
## 17.05.0-ce (2017-05-04)

View File

@ -4,3 +4,4 @@ Want to contribute on Docker CE? Awesome!
* Changes to the `engine` should be directed upstream to https://github.com/moby/moby
* Changes to the `cli` should be directed upstream to https://github.com/docker/cli
* Changes to the `packaging` should be directed upstream to https://github.com/docker/docker-ce-packaging

View File

@ -1,12 +1,24 @@
# Docker CE
This repository hosts open source components of Docker Community Edition
(CE) products. The `master` branch serves to unify the upstream components
on a regular basis. Long-lived release branches host the code that goes
into a product version for the lifetime of the product.
This repository hosts open source components of Docker CE products. The
`master` branch serves to unify the upstream components on a regular
basis. Long-lived release branches host the code that goes into a product
version for the lifetime of the product.
This repository is solely maintained by Docker, Inc.
## Issues
There are separate issue-tracking repos for the end user Docker CE
products specialized for a platform. Find your issue or file a new issue
for the platform you are using:
* https://github.com/docker/for-linux
* https://github.com/docker/for-mac
* https://github.com/docker/for-win
* https://github.com/docker/for-aws
* https://github.com/docker/for-azure
## Unifying upstream sources
The `master` branch is a combination of components adapted from

View File

@ -1 +1 @@
17.06.2-ce
17.07.0-ce

8
components/cli/.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,8 @@
# Github code owners
# See https://github.com/blog/2392-introducing-code-owners
cli/compose/** @dnephin @vdemeester
contrib/completion/bash/** @albers
contrib/completion/zsh/** @sdurrheimer
docs/** @mstanleyjones @vdemeester @thaJeztah
scripts/** @dnephin

View File

@ -6,3 +6,5 @@ cli/winresources/rsrc_amd64.syso
/man/man5/
/man/man8/
/docs/yaml/gen/
coverage.txt
profile.out

View File

@ -1,59 +1,66 @@
#
# github.com/docker/cli
#
all: binary
# remove build artifacts
.PHONY: clean
clean:
@rm -rf ./build/* cli/winresources/rsrc_* ./man/man[1-9] docs/yaml/gen
rm -rf ./build/* cli/winresources/rsrc_* ./man/man[1-9] docs/yaml/gen
# run go test
# the "-tags daemon" part is temporary
.PHONY: test
test:
@go test -tags daemon -v $(shell go list ./... | grep -v '/vendor/')
./scripts/test/unit $(shell go list ./... | grep -v '/vendor/')
.PHONY: test-coverage
test-coverage:
./scripts/test/unit-with-coverage $(shell go list ./... | grep -v '/vendor/')
.PHONY: lint
lint:
@gometalinter --config gometalinter.json ./...
gometalinter --config gometalinter.json ./...
.PHONY: binary
binary:
@./scripts/build/binary
@echo "WARNING: binary creates a Linux executable. Use cross for macOS or Windows."
./scripts/build/binary
# build the CLI for multiple architectures
.PHONY: cross
cross:
@./scripts/build/cross
./scripts/build/cross
.PHONY: dynbinary
dynbinary:
@./scripts/build/dynbinary
./scripts/build/dynbinary
.PHONY: watch
watch:
@./scripts/test/watch
./scripts/test/watch
# download dependencies (vendor/) listed in vendor.conf
.PHONY: vendor
# Check vendor matches vendor.conf
vendor: vendor.conf
@vndr 2> /dev/null
@scripts/validate/check-git-diff vendor
vndr 2> /dev/null
scripts/validate/check-git-diff vendor
## generate man pages from go source and markdown
.PHONY: manpages
manpages:
@scripts/docs/generate-man.sh
scripts/docs/generate-man.sh
## generate documentation YAML files consumed by docs repo
.PHONY: yamldocs
yamldocs:
@scripts/docs/generate-yaml.sh
scripts/docs/generate-yaml.sh
## Shellcheck validation
.PHONY: shellcheck
shellcheck:
scripts/validate/shellcheck
cli/compose/schema/bindata.go: cli/compose/schema/data/*.json
go generate github.com/docker/cli/cli/compose/schema
compose-jsonschema: cli/compose/schema/bindata.go
@scripts/validate/check-git-diff cli/compose/schema/bindata.go
scripts/validate/check-git-diff cli/compose/schema/bindata.go

View File

@ -1 +1 @@
17.06.2-ce
17.07.0-ce

View File

@ -1,49 +1,115 @@
version: 2
jobs:
build:
lint:
working_directory: /work
docker:
- image: docker:17.05
parallelism: 4
docker: [{image: 'docker:17.06-git'}]
steps:
- run:
name: "Install Git and SSH"
command: apk add -U git openssh
- checkout
- setup_remote_docker
- setup_remote_docker:
reusable: true
exclusive: false
- run:
command: docker version
- run:
name: "Lint"
command: |
if [ "$CIRCLE_NODE_INDEX" != "0" ]; then exit; fi
dockerfile=dockerfiles/Dockerfile.lint
echo "COPY . ." >> $dockerfile
docker build -f $dockerfile --tag cli-linter .
docker run cli-linter
docker build -f $dockerfile --tag cli-linter:$CIRCLE_BUILD_NUM .
docker run --rm cli-linter:$CIRCLE_BUILD_NUM
cross:
working_directory: /work
docker: [{image: 'docker:17.06-git'}]
parallelism: 3
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: false
- run:
name: "Cross"
command: |
if [ "$CIRCLE_NODE_INDEX" != "1" ]; then exit; fi
dockerfile=dockerfiles/Dockerfile.cross
echo "COPY . ." >> $dockerfile
docker build -f $dockerfile --tag cli-builder .
docker run --name cross cli-builder make cross
docker cp cross:/go/src/github.com/docker/cli/build /work/build
- run:
name: "Unit Test"
command: |
if [ "$CIRCLE_NODE_INDEX" != "2" ]; then exit; fi
dockerfile=dockerfiles/Dockerfile.dev
echo "COPY . ." >> $dockerfile
docker build -f $dockerfile --tag cli-builder .
docker run cli-builder make test
- run:
name: "Validate Vendor and Code Generation"
command: |
if [ "$CIRCLE_NODE_INDEX" != "3" ]; then exit; fi
dockerfile=dockerfiles/Dockerfile.dev
echo "COPY . ." >> $dockerfile
docker build -f $dockerfile --tag cli-builder .
docker run cli-builder make -B vendor compose-jsonschema
docker build -f $dockerfile --tag cli-builder:$CIRCLE_BUILD_NUM .
name=cross-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX
docker run \
-e CROSS_GROUP=$CIRCLE_NODE_INDEX \
--name $name cli-builder:$CIRCLE_BUILD_NUM \
make cross
docker cp \
$name:/go/src/github.com/docker/cli/build \
/work/build
- store_artifacts:
path: /work/build
test:
working_directory: /work
docker: [{image: 'docker:17.06-git'}]
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: false
- run:
name: "Unit Test with Coverage"
command: |
dockerfile=dockerfiles/Dockerfile.dev
echo "COPY . ." >> $dockerfile
docker build -f $dockerfile --tag cli-builder:$CIRCLE_BUILD_NUM .
docker run --name \
test-$CIRCLE_BUILD_NUM cli-builder:$CIRCLE_BUILD_NUM \
make test-coverage
- run:
name: "Upload to Codecov"
command: |
docker cp \
test-$CIRCLE_BUILD_NUM:/go/src/github.com/docker/cli/coverage.txt \
coverage.txt
apk add -U bash curl
curl -s https://codecov.io/bash | bash
validate:
working_directory: /work
docker: [{image: 'docker:17.06-git'}]
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: false
- run:
name: "Validate Vendor, Docs, and Code Generation"
command: |
dockerfile=dockerfiles/Dockerfile.dev
echo "COPY . ." >> $dockerfile
rm -f .dockerignore # include .git
docker build -f $dockerfile --tag cli-builder-with-git:$CIRCLE_BUILD_NUM .
docker run --rm cli-builder-with-git:$CIRCLE_BUILD_NUM \
make -B vendor compose-jsonschema manpages yamldocs
shellcheck:
working_directory: /work
docker: [{image: 'docker:17.06-git'}]
steps:
- checkout
- setup_remote_docker
- run:
name: "Run shellcheck"
command: |
dockerfile=dockerfiles/Dockerfile.shellcheck
echo "COPY . ." >> $dockerfile
docker build -f $dockerfile --tag cli-validator:$CIRCLE_BUILD_NUM .
docker run --rm cli-validator:$CIRCLE_BUILD_NUM \
make -B shellcheck
workflows:
version: 2
ci:
jobs:
- lint
- cross
- test
- validate
- shellcheck

View File

@ -0,0 +1,35 @@
package checkpoint
import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"golang.org/x/net/context"
)
type fakeClient struct {
client.Client
checkpointCreateFunc func(container string, options types.CheckpointCreateOptions) error
checkpointDeleteFunc func(container string, options types.CheckpointDeleteOptions) error
checkpointListFunc func(container string, options types.CheckpointListOptions) ([]types.Checkpoint, error)
}
func (cli *fakeClient) CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error {
if cli.checkpointCreateFunc != nil {
return cli.checkpointCreateFunc(container, options)
}
return nil
}
func (cli *fakeClient) CheckpointDelete(ctx context.Context, container string, options types.CheckpointDeleteOptions) error {
if cli.checkpointDeleteFunc != nil {
return cli.checkpointDeleteFunc(container, options)
}
return nil
}
func (cli *fakeClient) CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) {
if cli.checkpointListFunc != nil {
return cli.checkpointListFunc(container, options)
}
return []types.Checkpoint{}, nil
}

View File

@ -0,0 +1,72 @@
package checkpoint
import (
"io/ioutil"
"strings"
"testing"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/testutil"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
func TestCheckpointCreateErrors(t *testing.T) {
testCases := []struct {
args []string
checkpointCreateFunc func(container string, options types.CheckpointCreateOptions) error
expectedError string
}{
{
args: []string{"too-few-arguments"},
expectedError: "requires exactly 2 argument(s)",
},
{
args: []string{"too", "many", "arguments"},
expectedError: "requires exactly 2 argument(s)",
},
{
args: []string{"foo", "bar"},
checkpointCreateFunc: func(container string, options types.CheckpointCreateOptions) error {
return errors.Errorf("error creating checkpoint for container foo")
},
expectedError: "error creating checkpoint for container foo",
},
}
for _, tc := range testCases {
cli := test.NewFakeCli(&fakeClient{
checkpointCreateFunc: tc.checkpointCreateFunc,
})
cmd := newCreateCommand(cli)
cmd.SetArgs(tc.args)
cmd.SetOutput(ioutil.Discard)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
}
}
func TestCheckpointCreateWithOptions(t *testing.T) {
var containerID, checkpointID, checkpointDir string
var exit bool
cli := test.NewFakeCli(&fakeClient{
checkpointCreateFunc: func(container string, options types.CheckpointCreateOptions) error {
containerID = container
checkpointID = options.CheckpointID
checkpointDir = options.CheckpointDir
exit = options.Exit
return nil
},
})
cmd := newCreateCommand(cli)
checkpoint := "checkpoint-bar"
cmd.SetArgs([]string{"container-foo", checkpoint})
cmd.Flags().Set("leave-running", "true")
cmd.Flags().Set("checkpoint-dir", "/dir/foo")
assert.NoError(t, cmd.Execute())
assert.Equal(t, "container-foo", containerID)
assert.Equal(t, checkpoint, checkpointID)
assert.Equal(t, "/dir/foo", checkpointDir)
assert.Equal(t, false, exit)
assert.Equal(t, checkpoint, strings.TrimSpace(cli.OutBuffer().String()))
}

View File

@ -0,0 +1,71 @@
package checkpoint
import (
"bytes"
"io/ioutil"
"testing"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/testutil"
"github.com/docker/docker/pkg/testutil/golden"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
func TestCheckpointListErrors(t *testing.T) {
testCases := []struct {
args []string
checkpointListFunc func(container string, options types.CheckpointListOptions) ([]types.Checkpoint, error)
expectedError string
}{
{
args: []string{},
expectedError: "requires exactly 1 argument",
},
{
args: []string{"too", "many", "arguments"},
expectedError: "requires exactly 1 argument",
},
{
args: []string{"foo"},
checkpointListFunc: func(container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) {
return []types.Checkpoint{}, errors.Errorf("error getting checkpoints for container foo")
},
expectedError: "error getting checkpoints for container foo",
},
}
for _, tc := range testCases {
cli := test.NewFakeCliWithOutput(&fakeClient{
checkpointListFunc: tc.checkpointListFunc,
}, &bytes.Buffer{})
cmd := newListCommand(cli)
cmd.SetArgs(tc.args)
cmd.SetOutput(ioutil.Discard)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
}
}
func TestCheckpointListWithOptions(t *testing.T) {
var containerID, checkpointDir string
buf := new(bytes.Buffer)
cli := test.NewFakeCliWithOutput(&fakeClient{
checkpointListFunc: func(container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) {
containerID = container
checkpointDir = options.CheckpointDir
return []types.Checkpoint{
{Name: "checkpoint-foo"},
}, nil
},
}, buf)
cmd := newListCommand(cli)
cmd.SetArgs([]string{"container-foo"})
cmd.Flags().Set("checkpoint-dir", "/dir/foo")
assert.NoError(t, cmd.Execute())
assert.Equal(t, "container-foo", containerID)
assert.Equal(t, "/dir/foo", checkpointDir)
actual := buf.String()
expected := golden.Get(t, []byte(actual), "checkpoint-list-with-options.golden")
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, string(expected))
}

View File

@ -0,0 +1,66 @@
package checkpoint
import (
"bytes"
"io/ioutil"
"testing"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/testutil"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
func TestCheckpointRemoveErrors(t *testing.T) {
testCases := []struct {
args []string
checkpointDeleteFunc func(container string, options types.CheckpointDeleteOptions) error
expectedError string
}{
{
args: []string{"too-few-arguments"},
expectedError: "requires exactly 2 argument(s)",
},
{
args: []string{"too", "many", "arguments"},
expectedError: "requires exactly 2 argument(s)",
},
{
args: []string{"foo", "bar"},
checkpointDeleteFunc: func(container string, options types.CheckpointDeleteOptions) error {
return errors.Errorf("error deleting checkpoint")
},
expectedError: "error deleting checkpoint",
},
}
for _, tc := range testCases {
cli := test.NewFakeCliWithOutput(&fakeClient{
checkpointDeleteFunc: tc.checkpointDeleteFunc,
}, &bytes.Buffer{})
cmd := newRemoveCommand(cli)
cmd.SetArgs(tc.args)
cmd.SetOutput(ioutil.Discard)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
}
}
func TestCheckpointRemoveWithOptions(t *testing.T) {
var containerID, checkpointID, checkpointDir string
cli := test.NewFakeCliWithOutput(&fakeClient{
checkpointDeleteFunc: func(container string, options types.CheckpointDeleteOptions) error {
containerID = container
checkpointID = options.CheckpointID
checkpointDir = options.CheckpointDir
return nil
},
}, &bytes.Buffer{})
cmd := newRemoveCommand(cli)
cmd.SetArgs([]string{"container-foo", "checkpoint-bar"})
cmd.Flags().Set("checkpoint-dir", "/dir/foo")
assert.NoError(t, cmd.Execute())
assert.Equal(t, "container-foo", containerID)
assert.Equal(t, "checkpoint-bar", checkpointID)
assert.Equal(t, "/dir/foo", checkpointDir)
}

View File

@ -0,0 +1,2 @@
CHECKPOINT NAME
checkpoint-foo

View File

@ -1,7 +1,6 @@
package command
import (
"fmt"
"io"
"net"
"net/http"
@ -12,12 +11,9 @@ import (
"github.com/docker/cli/cli"
cliconfig "github.com/docker/cli/cli/config"
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/cli/config/credentials"
cliflags "github.com/docker/cli/cli/flags"
dopts "github.com/docker/cli/opts"
"github.com/docker/docker/api"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client"
"github.com/docker/go-connections/sockets"
"github.com/docker/go-connections/tlsconfig"
@ -42,7 +38,7 @@ type Cli interface {
In() *InStream
SetIn(in *InStream)
ConfigFile() *configfile.ConfigFile
CredentialsStore(serverAddress string) credentials.Store
ServerInfo() ServerInfo
}
// DockerCli is an instance the docker command line client.
@ -107,59 +103,10 @@ func (cli *DockerCli) ServerInfo() ServerInfo {
return cli.server
}
// GetAllCredentials returns all of the credentials stored in all of the
// configured credential stores.
func (cli *DockerCli) GetAllCredentials() (map[string]types.AuthConfig, error) {
auths := make(map[string]types.AuthConfig)
for registry := range cli.configFile.CredentialHelpers {
helper := cli.CredentialsStore(registry)
newAuths, err := helper.GetAll()
if err != nil {
return nil, err
}
addAll(auths, newAuths)
}
defaultStore := cli.CredentialsStore("")
newAuths, err := defaultStore.GetAll()
if err != nil {
return nil, err
}
addAll(auths, newAuths)
return auths, nil
}
func addAll(to, from map[string]types.AuthConfig) {
for reg, ac := range from {
to[reg] = ac
}
}
// CredentialsStore returns a new credentials store based
// on the settings provided in the configuration file. Empty string returns
// the default credential store.
func (cli *DockerCli) CredentialsStore(serverAddress string) credentials.Store {
if helper := getConfiguredCredentialStore(cli.configFile, serverAddress); helper != "" {
return credentials.NewNativeStore(cli.configFile, helper)
}
return credentials.NewFileStore(cli.configFile)
}
// getConfiguredCredentialStore returns the credential helper configured for the
// given registry, the default credsStore, or the empty string if neither are
// configured.
func getConfiguredCredentialStore(c *configfile.ConfigFile, serverAddress string) string {
if c.CredentialHelpers != nil && serverAddress != "" {
if helper, exists := c.CredentialHelpers[serverAddress]; exists {
return helper
}
}
return c.CredentialsStore
}
// Initialize the dockerCli runs initialization that must happen after command
// line flags are parsed.
func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions) error {
cli.configFile = LoadDefaultConfigFile(cli.err)
cli.configFile = cliconfig.LoadDefaultConfigFile(cli.err)
var err error
cli.client, err = NewAPIClientFromFlags(opts.Common, cli.configFile)
@ -195,15 +142,10 @@ func (cli *DockerCli) Initialize(opts *cliflags.ClientOptions) error {
OSType: ping.OSType,
}
// since the new header was added in 1.25, assume server is 1.24 if header is not present.
if ping.APIVersion == "" {
ping.APIVersion = "1.24"
}
// if server version is lower than the current cli, downgrade
if versions.LessThan(ping.APIVersion, cli.client.ClientVersion()) {
cli.client.UpdateClientVersion(ping.APIVersion)
}
cli.client.NegotiateAPIVersionPing(ping)
} else {
// Default to true if we fail to connect to daemon
cli.server = ServerInfo{HasExperimental: true}
}
return nil
@ -221,19 +163,6 @@ func NewDockerCli(in io.ReadCloser, out, err io.Writer) *DockerCli {
return &DockerCli{in: NewInStream(in), out: NewOutStream(out), err: err}
}
// LoadDefaultConfigFile attempts to load the default config file and returns
// an initialized ConfigFile struct if none is found.
func LoadDefaultConfigFile(err io.Writer) *configfile.ConfigFile {
configFile, e := cliconfig.Load(cliconfig.Dir())
if e != nil {
fmt.Fprintf(err, "WARNING: Error loading config file:%v\n", e)
}
if !configFile.ContainsAuth() {
credentials.DetectDefaultStore(configFile)
}
return configFile
}
// NewAPIClientFromFlags creates a new APIClient from command line flags
func NewAPIClientFromFlags(opts *cliflags.CommonOptions, configFile *configfile.ConfigFile) (client.APIClient, error) {
host, err := getServerHost(opts.Hosts, opts.TLSOptions)

View File

@ -10,7 +10,6 @@ import (
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/pkg/system"
runconfigopts "github.com/docker/docker/runconfig/opts"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
@ -65,7 +64,7 @@ func runConfigCreate(dockerCli command.Cli, options createOptions) error {
spec := swarm.ConfigSpec{
Annotations: swarm.Annotations{
Name: options.name,
Labels: runconfigopts.ConvertKVStringsToMap(options.labels.GetAll()),
Labels: opts.ConvertKVStringsToMap(options.labels.GetAll()),
},
Data: configData,
}

View File

@ -1,7 +1,6 @@
package config
import (
"bytes"
"io/ioutil"
"path/filepath"
"reflect"
@ -41,11 +40,10 @@ func TestConfigCreateErrors(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newConfigCreateCommand(
test.NewFakeCli(&fakeClient{
configCreateFunc: tc.configCreateFunc,
}, buf),
}),
)
cmd.SetArgs(tc.args)
cmd.SetOutput(ioutil.Discard)
@ -55,7 +53,6 @@ func TestConfigCreateErrors(t *testing.T) {
func TestConfigCreateWithName(t *testing.T) {
name := "foo"
buf := new(bytes.Buffer)
var actual []byte
cli := test.NewFakeCli(&fakeClient{
configCreateFunc: func(spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
@ -69,14 +66,14 @@ func TestConfigCreateWithName(t *testing.T) {
ID: "ID-" + spec.Name,
}, nil
},
}, buf)
})
cmd := newConfigCreateCommand(cli)
cmd.SetArgs([]string{name, filepath.Join("testdata", configDataFile)})
assert.NoError(t, cmd.Execute())
expected := golden.Get(t, actual, configDataFile)
assert.Equal(t, string(expected), string(actual))
assert.Equal(t, "ID-"+name, strings.TrimSpace(buf.String()))
assert.Equal(t, "ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))
}
func TestConfigCreateWithLabels(t *testing.T) {
@ -86,7 +83,6 @@ func TestConfigCreateWithLabels(t *testing.T) {
}
name := "foo"
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
configCreateFunc: func(spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) {
if spec.Name != name {
@ -101,12 +97,12 @@ func TestConfigCreateWithLabels(t *testing.T) {
ID: "ID-" + spec.Name,
}, nil
},
}, buf)
})
cmd := newConfigCreateCommand(cli)
cmd.SetArgs([]string{name, filepath.Join("testdata", configDataFile)})
cmd.Flags().Set("label", "lbl1=Label-foo")
cmd.Flags().Set("label", "lbl2=Label-bar")
assert.NoError(t, cmd.Execute())
assert.Equal(t, "ID-"+name, strings.TrimSpace(buf.String()))
assert.Equal(t, "ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))
}

View File

@ -55,7 +55,7 @@ func TestConfigInspectErrors(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newConfigInspectCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
configInspectFunc: tc.configInspectFunc,
}, buf),
)
@ -97,7 +97,7 @@ func TestConfigInspectWithoutFormat(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newConfigInspectCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
configInspectFunc: tc.configInspectFunc,
}, buf),
)
@ -137,7 +137,7 @@ func TestConfigInspectWithFormat(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newConfigInspectCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
configInspectFunc: tc.configInspectFunc,
}, buf),
)
@ -174,7 +174,7 @@ func TestConfigInspectPretty(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newConfigInspectCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
configInspectFunc: tc.configInspectFunc,
}, buf))
cmd.SetArgs([]string{"configID"})

View File

@ -1,7 +1,6 @@
package config
import (
"bytes"
"io/ioutil"
"testing"
"time"
@ -36,11 +35,10 @@ func TestConfigListErrors(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newConfigListCommand(
test.NewFakeCli(&fakeClient{
configListFunc: tc.configListFunc,
}, buf),
}),
)
cmd.SetArgs(tc.args)
cmd.SetOutput(ioutil.Discard)
@ -49,7 +47,6 @@ func TestConfigListErrors(t *testing.T) {
}
func TestConfigList(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) {
return []swarm.Config{
@ -67,18 +64,16 @@ func TestConfigList(t *testing.T) {
),
}, nil
},
}, buf)
cli.SetConfigfile(&configfile.ConfigFile{})
})
cmd := newConfigListCommand(cli)
cmd.SetOutput(buf)
cmd.SetOutput(cli.OutBuffer())
assert.NoError(t, cmd.Execute())
actual := buf.String()
actual := cli.OutBuffer().String()
expected := golden.Get(t, []byte(actual), "config-list.golden")
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, string(expected))
}
func TestConfigListWithQuietOption(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) {
return []swarm.Config{
@ -88,18 +83,16 @@ func TestConfigListWithQuietOption(t *testing.T) {
})),
}, nil
},
}, buf)
cli.SetConfigfile(&configfile.ConfigFile{})
})
cmd := newConfigListCommand(cli)
cmd.Flags().Set("quiet", "true")
assert.NoError(t, cmd.Execute())
actual := buf.String()
actual := cli.OutBuffer().String()
expected := golden.Get(t, []byte(actual), "config-list-with-quiet-option.golden")
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, string(expected))
}
func TestConfigListWithConfigFormat(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) {
return []swarm.Config{
@ -109,19 +102,18 @@ func TestConfigListWithConfigFormat(t *testing.T) {
})),
}, nil
},
}, buf)
cli.SetConfigfile(&configfile.ConfigFile{
})
cli.SetConfigFile(&configfile.ConfigFile{
ConfigFormat: "{{ .Name }} {{ .Labels }}",
})
cmd := newConfigListCommand(cli)
assert.NoError(t, cmd.Execute())
actual := buf.String()
actual := cli.OutBuffer().String()
expected := golden.Get(t, []byte(actual), "config-list-with-config-format.golden")
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, string(expected))
}
func TestConfigListWithFormat(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) {
return []swarm.Config{
@ -131,17 +123,16 @@ func TestConfigListWithFormat(t *testing.T) {
})),
}, nil
},
}, buf)
})
cmd := newConfigListCommand(cli)
cmd.Flags().Set("format", "{{ .Name }} {{ .Labels }}")
assert.NoError(t, cmd.Execute())
actual := buf.String()
actual := cli.OutBuffer().String()
expected := golden.Get(t, []byte(actual), "config-list-with-format.golden")
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, string(expected))
}
func TestConfigListWithFilter(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) {
assert.Equal(t, "foo", options.Filters.Get("name")[0])
@ -161,13 +152,12 @@ func TestConfigListWithFilter(t *testing.T) {
),
}, nil
},
}, buf)
cli.SetConfigfile(&configfile.ConfigFile{})
})
cmd := newConfigListCommand(cli)
cmd.Flags().Set("filter", "name=foo")
cmd.Flags().Set("filter", "label=lbl1=Label-bar")
assert.NoError(t, cmd.Execute())
actual := buf.String()
actual := cli.OutBuffer().String()
expected := golden.Get(t, []byte(actual), "config-list-with-filter.golden")
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, string(expected))
}

View File

@ -33,7 +33,7 @@ func TestConfigRemoveErrors(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newConfigRemoveCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
configRemoveFunc: tc.configRemoveFunc,
}, buf),
)
@ -47,7 +47,7 @@ func TestConfigRemoveWithName(t *testing.T) {
names := []string{"foo", "bar"}
buf := new(bytes.Buffer)
var removedConfigs []string
cli := test.NewFakeCli(&fakeClient{
cli := test.NewFakeCliWithOutput(&fakeClient{
configRemoveFunc: func(name string) error {
removedConfigs = append(removedConfigs, name)
return nil
@ -65,7 +65,7 @@ func TestConfigRemoveContinueAfterError(t *testing.T) {
buf := new(bytes.Buffer)
var removedConfigs []string
cli := test.NewFakeCli(&fakeClient{
cli := test.NewFakeCliWithOutput(&fakeClient{
configRemoveFunc: func(name string) error {
removedConfigs = append(removedConfigs, name)
if name == "foo" {
@ -77,6 +77,7 @@ func TestConfigRemoveContinueAfterError(t *testing.T) {
cmd := newConfigRemoveCommand(cli)
cmd.SetArgs(names)
cmd.SetOutput(ioutil.Discard)
assert.EqualError(t, cmd.Execute(), "error removing config: foo")
assert.Equal(t, names, removedConfigs)
}

View File

@ -8,6 +8,7 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/signal"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@ -22,8 +23,26 @@ type attachOptions struct {
container string
}
func inspectContainerAndCheckState(ctx context.Context, cli client.APIClient, args string) (*types.ContainerJSON, error) {
c, err := cli.ContainerInspect(ctx, args)
if err != nil {
return nil, err
}
if !c.State.Running {
return nil, errors.New("You cannot attach to a stopped container, start it first")
}
if c.State.Paused {
return nil, errors.New("You cannot attach to a paused container, unpause it first")
}
if c.State.Restarting {
return nil, errors.New("You cannot attach to a restarting container, wait until it is running")
}
return &c, nil
}
// NewAttachCommand creates a new cobra.Command for `docker attach`
func NewAttachCommand(dockerCli *command.DockerCli) *cobra.Command {
func NewAttachCommand(dockerCli command.Cli) *cobra.Command {
var opts attachOptions
cmd := &cobra.Command{
@ -43,23 +62,15 @@ func NewAttachCommand(dockerCli *command.DockerCli) *cobra.Command {
return cmd
}
func runAttach(dockerCli *command.DockerCli, opts *attachOptions) error {
func runAttach(dockerCli command.Cli, opts *attachOptions) error {
ctx := context.Background()
client := dockerCli.Client()
c, err := client.ContainerInspect(ctx, opts.container)
c, err := inspectContainerAndCheckState(ctx, client, opts.container)
if err != nil {
return err
}
if !c.State.Running {
return errors.New("You cannot attach to a stopped container, start it first")
}
if c.State.Paused {
return errors.New("You cannot attach to a paused container, unpause it first")
}
if err := dockerCli.In().CheckTty(!opts.noStdin, c.Config.Tty); err != nil {
return err
}
@ -95,6 +106,19 @@ func runAttach(dockerCli *command.DockerCli, opts *attachOptions) error {
}
defer resp.Close()
// If use docker attach command to attach to a stop container, it will return
// "You cannot attach to a stopped container" error, it's ok, but when
// attach to a running container, it(docker attach) use inspect to check
// the container's state, if it pass the state check on the client side,
// and then the container is stopped, docker attach command still attach to
// the container and not exit.
//
// Recheck the container's state to avoid attach block.
_, err = inspectContainerAndCheckState(ctx, client, opts.container)
if err != nil {
return err
}
if c.Config.Tty && dockerCli.Out().IsTerminal() {
height, width := dockerCli.Out().GetTtySize()
// To handle the case where a user repeatedly attaches/detaches without resizing their

View File

@ -0,0 +1,75 @@
package container
import (
"io/ioutil"
"testing"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/testutil"
"github.com/pkg/errors"
)
func TestNewAttachCommandErrors(t *testing.T) {
testCases := []struct {
name string
args []string
expectedError string
containerInspectFunc func(img string) (types.ContainerJSON, error)
}{
{
name: "client-error",
args: []string{"5cb5bb5e4a3b"},
expectedError: "something went wrong",
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
return types.ContainerJSON{}, errors.Errorf("something went wrong")
},
},
{
name: "client-stopped",
args: []string{"5cb5bb5e4a3b"},
expectedError: "You cannot attach to a stopped container",
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
c := types.ContainerJSON{}
c.ContainerJSONBase = &types.ContainerJSONBase{}
c.ContainerJSONBase.State = &types.ContainerState{Running: false}
return c, nil
},
},
{
name: "client-paused",
args: []string{"5cb5bb5e4a3b"},
expectedError: "You cannot attach to a paused container",
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
c := types.ContainerJSON{}
c.ContainerJSONBase = &types.ContainerJSONBase{}
c.ContainerJSONBase.State = &types.ContainerState{
Running: true,
Paused: true,
}
return c, nil
},
},
{
name: "client-restarting",
args: []string{"5cb5bb5e4a3b"},
expectedError: "You cannot attach to a restarting container",
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
c := types.ContainerJSON{}
c.ContainerJSONBase = &types.ContainerJSONBase{}
c.ContainerJSONBase.State = &types.ContainerState{
Running: true,
Paused: false,
Restarting: true,
}
return c, nil
},
},
}
for _, tc := range testCases {
cmd := NewAttachCommand(test.NewFakeCli(&fakeClient{containerInspectFunc: tc.containerInspectFunc}))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
}
}

View File

@ -0,0 +1,19 @@
package container
import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"golang.org/x/net/context"
)
type fakeClient struct {
client.Client
containerInspectFunc func(string) (types.ContainerJSON, error)
}
func (cli *fakeClient) ContainerInspect(_ context.Context, containerID string) (types.ContainerJSON, error) {
if cli.containerInspectFunc != nil {
return cli.containerInspectFunc(containerID)
}
return types.ContainerJSON{}, nil
}

View File

@ -33,7 +33,7 @@ func newExecOptions() *execOptions {
}
// NewExecCommand creates a new cobra.Command for `docker exec`
func NewExecCommand(dockerCli *command.DockerCli) *cobra.Command {
func NewExecCommand(dockerCli command.Cli) *cobra.Command {
options := newExecOptions()
cmd := &cobra.Command{
@ -63,7 +63,7 @@ func NewExecCommand(dockerCli *command.DockerCli) *cobra.Command {
}
// nolint: gocyclo
func runExec(dockerCli *command.DockerCli, options *execOptions, container string, execCmd []string) error {
func runExec(dockerCli command.Cli, options *execOptions, container string, execCmd []string) error {
execConfig, err := parseExec(options, execCmd)
// just in case the ParseExec does not exit
if container == "" || err != nil {
@ -111,12 +111,7 @@ func runExec(dockerCli *command.DockerCli, options *execOptions, container strin
Tty: execConfig.Tty,
}
if err := client.ContainerExecStart(ctx, execID, execStartCheck); err != nil {
return err
}
// For now don't print this - wait for when we support exec wait()
// fmt.Fprintf(dockerCli.Out(), "%s\n", execID)
return nil
return client.ContainerExecStart(ctx, execID, execStartCheck)
}
// Interactive exec requested.

View File

@ -1,9 +1,14 @@
package container
import (
"io/ioutil"
"testing"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/testutil"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"
)
type arguments struct {
@ -73,9 +78,7 @@ func TestParseExec(t *testing.T) {
for valid, expectedExecConfig := range valids {
execConfig, err := parseExec(&valid.options, valid.execCmd)
if err != nil {
t.Fatal(err)
}
require.NoError(t, err)
if !compareExecConfig(expectedExecConfig, execConfig) {
t.Fatalf("Expected [%v] for %v, got [%v]", expectedExecConfig, valid, execConfig)
}
@ -114,3 +117,28 @@ func compareExecConfig(config1 *types.ExecConfig, config2 *types.ExecConfig) boo
}
return true
}
func TestNewExecCommandErrors(t *testing.T) {
testCases := []struct {
name string
args []string
expectedError string
containerInspectFunc func(img string) (types.ContainerJSON, error)
}{
{
name: "client-error",
args: []string{"5cb5bb5e4a3b", "-t", "-i", "bash"},
expectedError: "something went wrong",
containerInspectFunc: func(containerID string) (types.ContainerJSON, error) {
return types.ContainerJSON{}, errors.Errorf("something went wrong")
},
},
}
for _, tc := range testCases {
cli := test.NewFakeCli(&fakeClient{containerInspectFunc: tc.containerInspectFunc})
cmd := NewExecCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
}
}

View File

@ -110,7 +110,7 @@ func (h *hijackedIOStreamer) setupInput() (restore func(), err error) {
func (h *hijackedIOStreamer) beginOutputStream(restoreInput func()) <-chan error {
if h.outputStream == nil && h.errorStream == nil {
// Ther is no need to copy output.
// There is no need to copy output.
return nil
}
@ -163,7 +163,7 @@ func (h *hijackedIOStreamer) beginInputStream(restoreInput func()) (doneC <-chan
if err != nil {
// This error will also occur on the receive
// side (from stdout) where it will be
// propogated back to the caller.
// propagated back to the caller.
logrus.Debugf("Error sendStdin: %s", err)
}
}

View File

@ -12,19 +12,19 @@ import (
"time"
"github.com/Sirupsen/logrus"
"github.com/docker/cli/cli/compose/loader"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types/container"
networktypes "github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/strslice"
"github.com/docker/docker/pkg/signal"
runconfigopts "github.com/docker/docker/runconfig/opts"
"github.com/docker/go-connections/nat"
"github.com/pkg/errors"
"github.com/spf13/pflag"
)
var (
deviceCgroupRuleRegexp = regexp.MustCompile("^[acb] ([0-9]+|\\*):([0-9]+|\\*) [rwm]{1,3}$")
deviceCgroupRuleRegexp = regexp.MustCompile(`^[acb] ([0-9]+|\*):([0-9]+|\*) [rwm]{1,3}$`)
)
// containerOptions is a data object with all the options for creating a container
@ -333,7 +333,8 @@ func parse(flags *pflag.FlagSet, copts *containerOptions) (*containerConfig, err
volumes := copts.volumes.GetMap()
// add any bind targets to the list of container volumes
for bind := range copts.volumes.GetMap() {
if arr := volumeSplitN(bind, 2); len(arr) > 1 {
parsed, _ := loader.ParseVolume(bind)
if parsed.Source != "" {
// after creating the bind mount we want to delete it from the copts.volumes values because
// we do not want bind mounts being committed to image configs
binds = append(binds, bind)
@ -409,13 +410,13 @@ func parse(flags *pflag.FlagSet, copts *containerOptions) (*containerConfig, err
}
// collect all the environment variables for the container
envVariables, err := runconfigopts.ReadKVStrings(copts.envFile.GetAll(), copts.env.GetAll())
envVariables, err := opts.ReadKVStrings(copts.envFile.GetAll(), copts.env.GetAll())
if err != nil {
return nil, err
}
// collect all the labels for the container
labels, err := runconfigopts.ReadKVStrings(copts.labelsFile.GetAll(), copts.labels.GetAll())
labels, err := opts.ReadKVStrings(copts.labelsFile.GetAll(), copts.labels.GetAll())
if err != nil {
return nil, err
}
@ -440,7 +441,7 @@ func parse(flags *pflag.FlagSet, copts *containerOptions) (*containerConfig, err
return nil, errors.Errorf("--userns: invalid USER mode")
}
restartPolicy, err := runconfigopts.ParseRestartPolicy(copts.restartPolicy)
restartPolicy, err := opts.ParseRestartPolicy(copts.restartPolicy)
if err != nil {
return nil, err
}
@ -553,7 +554,7 @@ func parse(flags *pflag.FlagSet, copts *containerOptions) (*containerConfig, err
MacAddress: copts.macAddress,
Entrypoint: entrypoint,
WorkingDir: copts.workingDir,
Labels: runconfigopts.ConvertKVStringsToMap(labels),
Labels: opts.ConvertKVStringsToMap(labels),
Healthcheck: healthConfig,
}
if flags.Changed("stop-signal") {
@ -666,7 +667,7 @@ func parse(flags *pflag.FlagSet, copts *containerOptions) (*containerConfig, err
}
func parseLoggingOpts(loggingDriver string, loggingOpts []string) (map[string]string, error) {
loggingOptsMap := runconfigopts.ConvertKVStringsToMap(loggingOpts)
loggingOptsMap := opts.ConvertKVStringsToMap(loggingOpts)
if loggingDriver == "none" && len(loggingOpts) > 0 {
return map[string]string{}, errors.Errorf("invalid logging opts for driver %s", loggingDriver)
}
@ -828,67 +829,6 @@ func validatePath(val string, validator func(string) bool) (string, error) {
return val, nil
}
// volumeSplitN splits raw into a maximum of n parts, separated by a separator colon.
// A separator colon is the last `:` character in the regex `[:\\]?[a-zA-Z]:` (note `\\` is `\` escaped).
// In Windows driver letter appears in two situations:
// a. `^[a-zA-Z]:` (A colon followed by `^[a-zA-Z]:` is OK as colon is the separator in volume option)
// b. A string in the format like `\\?\C:\Windows\...` (UNC).
// Therefore, a driver letter can only follow either a `:` or `\\`
// This allows to correctly split strings such as `C:\foo:D:\:rw` or `/tmp/q:/foo`.
func volumeSplitN(raw string, n int) []string {
var array []string
if len(raw) == 0 || raw[0] == ':' {
// invalid
return nil
}
// numberOfParts counts the number of parts separated by a separator colon
numberOfParts := 0
// left represents the left-most cursor in raw, updated at every `:` character considered as a separator.
left := 0
// right represents the right-most cursor in raw incremented with the loop. Note this
// starts at index 1 as index 0 is already handle above as a special case.
for right := 1; right < len(raw); right++ {
// stop parsing if reached maximum number of parts
if n >= 0 && numberOfParts >= n {
break
}
if raw[right] != ':' {
continue
}
potentialDriveLetter := raw[right-1]
if (potentialDriveLetter >= 'A' && potentialDriveLetter <= 'Z') || (potentialDriveLetter >= 'a' && potentialDriveLetter <= 'z') {
if right > 1 {
beforePotentialDriveLetter := raw[right-2]
// Only `:` or `\\` are checked (`/` could fall into the case of `/tmp/q:/foo`)
if beforePotentialDriveLetter != ':' && beforePotentialDriveLetter != '\\' {
// e.g. `C:` is not preceded by any delimiter, therefore it was not a drive letter but a path ending with `C:`.
array = append(array, raw[left:right])
left = right + 1
numberOfParts++
}
// else, `C:` is considered as a drive letter and not as a delimiter, so we continue parsing.
}
// if right == 1, then `C:` is the beginning of the raw string, therefore `:` is again not considered a delimiter and we continue parsing.
} else {
// if `:` is not preceded by a potential drive letter, then consider it as a delimiter.
array = append(array, raw[left:right])
left = right + 1
numberOfParts++
}
}
// need to take care of the last part
if left < len(raw) {
if n >= 0 && numberOfParts >= n {
// if the maximum number of parts is reached, just append the rest to the last part
// left-1 is at the last `:` that needs to be included since not considered a separator.
array[n-1] += raw[left-1:]
} else {
array = append(array, raw[left:])
}
}
return array
}
// validateAttach validates that the specified string is a valid attach option.
func validateAttach(val string) (string, error) {
s := strings.ToLower(val)

View File

@ -19,6 +19,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/pflag"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestValidateAttach(t *testing.T) {
@ -61,16 +62,14 @@ func parseRun(args []string) (*container.Config, *container.HostConfig, *network
return containerConfig.Config, containerConfig.HostConfig, containerConfig.NetworkingConfig, err
}
func parsetest(t *testing.T, args string) (*container.Config, *container.HostConfig, error) {
config, hostConfig, _, err := parseRun(strings.Split(args+" ubuntu bash", " "))
return config, hostConfig, err
func parseMustError(t *testing.T, args string) {
_, _, _, err := parseRun(strings.Split(args+" ubuntu bash", " "))
assert.Error(t, err, args)
}
func mustParse(t *testing.T, args string) (*container.Config, *container.HostConfig) {
config, hostConfig, err := parsetest(t, args)
if err != nil {
t.Fatal(err)
}
config, hostConfig, _, err := parseRun(append(strings.Split(args, " "), "ubuntu", "bash"))
assert.NoError(t, err)
return config, hostConfig
}
@ -86,7 +85,6 @@ func TestParseRunLinks(t *testing.T) {
}
}
// nolint: gocyclo
func TestParseRunAttach(t *testing.T) {
if config, _ := mustParse(t, "-a stdin"); !config.AttachStdin || config.AttachStdout || config.AttachStderr {
t.Fatalf("Error parsing attach flags. Expect only Stdin enabled. Received: in: %v, out: %v, err: %v", config.AttachStdin, config.AttachStdout, config.AttachStderr)
@ -103,31 +101,17 @@ func TestParseRunAttach(t *testing.T) {
if config, _ := mustParse(t, "-i"); !config.AttachStdin || !config.AttachStdout || !config.AttachStderr {
t.Fatalf("Error parsing attach flags. Expect Stdin enabled. Received: in: %v, out: %v, err: %v", config.AttachStdin, config.AttachStdout, config.AttachStderr)
}
}
if _, _, err := parsetest(t, "-a"); err == nil {
t.Fatal("Error parsing attach flags, `-a` should be an error but is not")
}
if _, _, err := parsetest(t, "-a invalid"); err == nil {
t.Fatal("Error parsing attach flags, `-a invalid` should be an error but is not")
}
if _, _, err := parsetest(t, "-a invalid -a stdout"); err == nil {
t.Fatal("Error parsing attach flags, `-a stdout -a invalid` should be an error but is not")
}
if _, _, err := parsetest(t, "-a stdout -a stderr -d"); err == nil {
t.Fatal("Error parsing attach flags, `-a stdout -a stderr -d` should be an error but is not")
}
if _, _, err := parsetest(t, "-a stdin -d"); err == nil {
t.Fatal("Error parsing attach flags, `-a stdin -d` should be an error but is not")
}
if _, _, err := parsetest(t, "-a stdout -d"); err == nil {
t.Fatal("Error parsing attach flags, `-a stdout -d` should be an error but is not")
}
if _, _, err := parsetest(t, "-a stderr -d"); err == nil {
t.Fatal("Error parsing attach flags, `-a stderr -d` should be an error but is not")
}
if _, _, err := parsetest(t, "-d --rm"); err == nil {
t.Fatal("Error parsing attach flags, `-d --rm` should be an error but is not")
}
func TestParseRunWithInvalidArgs(t *testing.T) {
parseMustError(t, "-a")
parseMustError(t, "-a invalid")
parseMustError(t, "-a invalid -a stdout")
parseMustError(t, "-a stdout -a stderr -d")
parseMustError(t, "-a stdin -d")
parseMustError(t, "-a stdout -d")
parseMustError(t, "-a stderr -d")
parseMustError(t, "-d --rm")
}
// nolint: gocyclo
@ -383,51 +367,46 @@ func TestParseDevice(t *testing.T) {
func TestParseModes(t *testing.T) {
// ipc ko
if _, _, _, err := parseRun([]string{"--ipc=container:", "img", "cmd"}); err == nil || err.Error() != "--ipc: invalid IPC mode" {
t.Fatalf("Expected an error with message '--ipc: invalid IPC mode', got %v", err)
}
_, _, _, err := parseRun([]string{"--ipc=container:", "img", "cmd"})
testutil.ErrorContains(t, err, "--ipc: invalid IPC mode")
// ipc ok
_, hostconfig, _, err := parseRun([]string{"--ipc=host", "img", "cmd"})
if err != nil {
t.Fatal(err)
}
require.NoError(t, err)
if !hostconfig.IpcMode.Valid() {
t.Fatalf("Expected a valid IpcMode, got %v", hostconfig.IpcMode)
}
// pid ko
if _, _, _, err := parseRun([]string{"--pid=container:", "img", "cmd"}); err == nil || err.Error() != "--pid: invalid PID mode" {
t.Fatalf("Expected an error with message '--pid: invalid PID mode', got %v", err)
}
_, _, _, err = parseRun([]string{"--pid=container:", "img", "cmd"})
testutil.ErrorContains(t, err, "--pid: invalid PID mode")
// pid ok
_, hostconfig, _, err = parseRun([]string{"--pid=host", "img", "cmd"})
if err != nil {
t.Fatal(err)
}
require.NoError(t, err)
if !hostconfig.PidMode.Valid() {
t.Fatalf("Expected a valid PidMode, got %v", hostconfig.PidMode)
}
// uts ko
if _, _, _, err := parseRun([]string{"--uts=container:", "img", "cmd"}); err == nil || err.Error() != "--uts: invalid UTS mode" {
t.Fatalf("Expected an error with message '--uts: invalid UTS mode', got %v", err)
}
_, _, _, err = parseRun([]string{"--uts=container:", "img", "cmd"})
testutil.ErrorContains(t, err, "--uts: invalid UTS mode")
// uts ok
_, hostconfig, _, err = parseRun([]string{"--uts=host", "img", "cmd"})
if err != nil {
t.Fatal(err)
}
require.NoError(t, err)
if !hostconfig.UTSMode.Valid() {
t.Fatalf("Expected a valid UTSMode, got %v", hostconfig.UTSMode)
}
// shm-size ko
expectedErr := `invalid argument "a128m" for --shm-size=a128m: invalid size: 'a128m'`
if _, _, _, err = parseRun([]string{"--shm-size=a128m", "img", "cmd"}); err == nil || err.Error() != expectedErr {
t.Fatalf("Expected an error with message '%v', got %v", expectedErr, err)
}
_, _, _, err = parseRun([]string{"--shm-size=a128m", "img", "cmd"})
testutil.ErrorContains(t, err, expectedErr)
// shm-size ok
_, hostconfig, _, err = parseRun([]string{"--shm-size=128m", "img", "cmd"})
if err != nil {
t.Fatal(err)
}
require.NoError(t, err)
if hostconfig.ShmSize != 134217728 {
t.Fatalf("Expected a valid ShmSize, got %d", hostconfig.ShmSize)
}
@ -771,58 +750,6 @@ func callDecodeContainerConfig(volumes []string, binds []string) (*container.Con
return c, h, err
}
func TestVolumeSplitN(t *testing.T) {
for _, x := range []struct {
input string
n int
expected []string
}{
{`C:\foo:d:`, -1, []string{`C:\foo`, `d:`}},
{`:C:\foo:d:`, -1, nil},
{`/foo:/bar:ro`, 3, []string{`/foo`, `/bar`, `ro`}},
{`/foo:/bar:ro`, 2, []string{`/foo`, `/bar:ro`}},
{`C:\foo\:/foo`, -1, []string{`C:\foo\`, `/foo`}},
{`d:\`, -1, []string{`d:\`}},
{`d:`, -1, []string{`d:`}},
{`d:\path`, -1, []string{`d:\path`}},
{`d:\path with space`, -1, []string{`d:\path with space`}},
{`d:\pathandmode:rw`, -1, []string{`d:\pathandmode`, `rw`}},
{`c:\:d:\`, -1, []string{`c:\`, `d:\`}},
{`c:\windows\:d:`, -1, []string{`c:\windows\`, `d:`}},
{`c:\windows:d:\s p a c e`, -1, []string{`c:\windows`, `d:\s p a c e`}},
{`c:\windows:d:\s p a c e:RW`, -1, []string{`c:\windows`, `d:\s p a c e`, `RW`}},
{`c:\program files:d:\s p a c e i n h o s t d i r`, -1, []string{`c:\program files`, `d:\s p a c e i n h o s t d i r`}},
{`0123456789name:d:`, -1, []string{`0123456789name`, `d:`}},
{`MiXeDcAsEnAmE:d:`, -1, []string{`MiXeDcAsEnAmE`, `d:`}},
{`name:D:`, -1, []string{`name`, `D:`}},
{`name:D::rW`, -1, []string{`name`, `D:`, `rW`}},
{`name:D::RW`, -1, []string{`name`, `D:`, `RW`}},
{`c:/:d:/forward/slashes/are/good/too`, -1, []string{`c:/`, `d:/forward/slashes/are/good/too`}},
{`c:\Windows`, -1, []string{`c:\Windows`}},
{`c:\Program Files (x86)`, -1, []string{`c:\Program Files (x86)`}},
{``, -1, nil},
{`.`, -1, []string{`.`}},
{`..\`, -1, []string{`..\`}},
{`c:\:..\`, -1, []string{`c:\`, `..\`}},
{`c:\:d:\:xyzzy`, -1, []string{`c:\`, `d:\`, `xyzzy`}},
// Cover directories with one-character name
{`/tmp/x/y:/foo/x/y`, -1, []string{`/tmp/x/y`, `/foo/x/y`}},
} {
res := volumeSplitN(x.input, x.n)
if len(res) < len(x.expected) {
t.Fatalf("input: %v, expected: %v, got: %v", x.input, x.expected, res)
}
for i, e := range res {
if e != x.expected[i] {
t.Fatalf("input: %v, expected: %v, got: %v", x.input, x.expected, res)
}
}
}
}
func TestValidateDevice(t *testing.T) {
valid := []string{
"/home",

View File

@ -5,6 +5,7 @@ import (
"io"
"net/http/httputil"
"os"
"regexp"
"runtime"
"strings"
"syscall"
@ -12,12 +13,12 @@ import (
"github.com/Sirupsen/logrus"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/signal"
"github.com/docker/docker/pkg/term"
"github.com/docker/libnetwork/resolvconf/dns"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@ -77,21 +78,43 @@ func warnOnOomKillDisable(hostConfig container.HostConfig, stderr io.Writer) {
// they are trying to set a DNS to a localhost address
func warnOnLocalhostDNS(hostConfig container.HostConfig, stderr io.Writer) {
for _, dnsIP := range hostConfig.DNS {
if dns.IsLocalhost(dnsIP) {
if isLocalhost(dnsIP) {
fmt.Fprintf(stderr, "WARNING: Localhost DNS setting (--dns=%s) may fail in containers.\n", dnsIP)
return
}
}
}
func runRun(dockerCli *command.DockerCli, flags *pflag.FlagSet, opts *runOptions, copts *containerOptions) error {
// IPLocalhost is a regex pattern for IPv4 or IPv6 loopback range.
const ipLocalhost = `((127\.([0-9]{1,3}\.){2}[0-9]{1,3})|(::1)$)`
var localhostIPRegexp = regexp.MustCompile(ipLocalhost)
// IsLocalhost returns true if ip matches the localhost IP regular expression.
// Used for determining if nameserver settings are being passed which are
// localhost addresses
func isLocalhost(ip string) bool {
return localhostIPRegexp.MatchString(ip)
}
func runRun(dockerCli *command.DockerCli, flags *pflag.FlagSet, ropts *runOptions, copts *containerOptions) error {
proxyConfig := dockerCli.ConfigFile().ParseProxyConfig(dockerCli.Client().DaemonHost(), copts.env.GetAll())
newEnv := []string{}
for k, v := range proxyConfig {
if v == nil {
newEnv = append(newEnv, k)
} else {
newEnv = append(newEnv, fmt.Sprintf("%s=%s", k, *v))
}
}
copts.env = *opts.NewListOptsRef(&newEnv, nil)
containerConfig, err := parse(flags, copts)
// just in case the parse does not exit
if err != nil {
reportError(dockerCli.Err(), "run", err.Error(), true)
return cli.StatusError{StatusCode: 125}
}
return runContainer(dockerCli, opts, copts, containerConfig)
return runContainer(dockerCli, ropts, copts, containerConfig)
}
// nolint: gocyclo
@ -147,6 +170,7 @@ func runContainer(dockerCli *command.DockerCli, opts *runOptions, copts *contain
sigc := ForwardAllSignals(ctx, dockerCli, createResponse.ID)
defer signal.StopCatch(sigc)
}
var (
waitDisplayID chan struct{}
errCh chan error
@ -166,10 +190,11 @@ func runContainer(dockerCli *command.DockerCli, opts *runOptions, copts *contain
}
close, err := attachContainer(ctx, dockerCli, &errCh, config, createResponse.ID)
defer close()
if err != nil {
return err
}
defer close()
}
statusChan := waitExitOrRemoved(ctx, dockerCli, createResponse.ID, copts.autoRemove)

View File

@ -146,12 +146,12 @@ func runStart(dockerCli *command.DockerCli, opts *startOptions) error {
fmt.Fprintln(dockerCli.Err(), "Error monitoring TTY size:", err)
}
}
if attchErr := <-cErr; attchErr != nil {
if attachErr := <-cErr; attachErr != nil {
if _, ok := err.(term.EscapeError); ok {
// The user entered the detach escape sequence.
return nil
}
return attchErr
return attachErr
}
if status := <-statusChan; status != 0 {

View File

@ -106,7 +106,7 @@ func runStats(dockerCli *command.DockerCli, opts *statsOptions) error {
closeChan <- err
}
for _, container := range cs {
s := formatter.NewContainerStats(container.ID[:12], daemonOSType)
s := formatter.NewContainerStats(container.ID[:12])
if cStats.add(s) {
waitFirst.Add(1)
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)
@ -123,7 +123,7 @@ func runStats(dockerCli *command.DockerCli, opts *statsOptions) error {
eh := command.InitEventHandler()
eh.Handle("create", func(e events.Message) {
if opts.all {
s := formatter.NewContainerStats(e.ID[:12], daemonOSType)
s := formatter.NewContainerStats(e.ID[:12])
if cStats.add(s) {
waitFirst.Add(1)
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)
@ -132,7 +132,7 @@ func runStats(dockerCli *command.DockerCli, opts *statsOptions) error {
})
eh.Handle("start", func(e events.Message) {
s := formatter.NewContainerStats(e.ID[:12], daemonOSType)
s := formatter.NewContainerStats(e.ID[:12])
if cStats.add(s) {
waitFirst.Add(1)
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)
@ -158,7 +158,7 @@ func runStats(dockerCli *command.DockerCli, opts *statsOptions) error {
// Artificially send creation events for the containers we were asked to
// monitor (same code path than we use when monitoring all containers).
for _, name := range opts.containers {
s := formatter.NewContainerStats(name, daemonOSType)
s := formatter.NewContainerStats(name)
if cStats.add(s) {
waitFirst.Add(1)
go collect(ctx, s, dockerCli.Client(), !opts.noStream, waitFirst)

View File

@ -16,9 +16,8 @@ import (
)
type stats struct {
ostype string
mu sync.Mutex
cs []*formatter.ContainerStats
mu sync.Mutex
cs []*formatter.ContainerStats
}
// daemonOSType is set once we have at least one stat for a container

View File

@ -39,7 +39,7 @@ func resizeTtyTo(ctx context.Context, client client.ContainerAPIClient, id strin
}
// MonitorTtySize updates the container tty size when the terminal tty changes size
func MonitorTtySize(ctx context.Context, cli *command.DockerCli, id string, isExec bool) error {
func MonitorTtySize(ctx context.Context, cli command.Cli, id string, isExec bool) error {
resizeTty := func() {
height, width := cli.Out().GetTtySize()
resizeTtyTo(ctx, cli.Client(), id, height, width, isExec)
@ -74,7 +74,7 @@ func MonitorTtySize(ctx context.Context, cli *command.DockerCli, id string, isEx
}
// ForwardAllSignals forwards signals to the container
func ForwardAllSignals(ctx context.Context, cli *command.DockerCli, cid string) chan os.Signal {
func ForwardAllSignals(ctx context.Context, cli command.Cli, cid string) chan os.Signal {
sigc := make(chan os.Signal, 128)
signal.CatchAll(sigc)
go func() {

View File

@ -8,7 +8,6 @@ import (
"github.com/docker/cli/cli/command"
"github.com/docker/cli/opts"
containertypes "github.com/docker/docker/api/types/container"
runconfigopts "github.com/docker/docker/runconfig/opts"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
@ -82,7 +81,7 @@ func runUpdate(dockerCli *command.DockerCli, options *updateOptions) error {
var restartPolicy containertypes.RestartPolicy
if options.restartPolicy != "" {
restartPolicy, err = runconfigopts.ParseRestartPolicy(options.restartPolicy)
restartPolicy, err = opts.ParseRestartPolicy(options.restartPolicy)
if err != nil {
return err
}

View File

@ -127,7 +127,7 @@ func legacyWaitExitOrRemoved(ctx context.Context, dockerCli *command.DockerCli,
// getExitCode performs an inspect on the container. It returns
// the running state and the exit code.
func getExitCode(ctx context.Context, dockerCli *command.DockerCli, containerID string) (bool, int, error) {
func getExitCode(ctx context.Context, dockerCli command.Cli, containerID string) (bool, int, error) {
c, err := dockerCli.Client().ContainerInspect(ctx, containerID)
if err != nil {
// If we can't connect, then the daemon probably died.

View File

@ -2,16 +2,16 @@ package formatter
import (
"fmt"
"sort"
"strconv"
"strings"
"time"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/stringutils"
units "github.com/docker/go-units"
"github.com/docker/go-units"
)
const (
@ -171,16 +171,16 @@ func (c *containerContext) Command() string {
}
func (c *containerContext) CreatedAt() string {
return time.Unix(int64(c.c.Created), 0).String()
return time.Unix(c.c.Created, 0).String()
}
func (c *containerContext) RunningFor() string {
createdAt := time.Unix(int64(c.c.Created), 0)
createdAt := time.Unix(c.c.Created, 0)
return units.HumanDuration(time.Now().UTC().Sub(createdAt)) + " ago"
}
func (c *containerContext) Ports() string {
return api.DisplayablePorts(c.c.Ports)
return DisplayablePorts(c.c.Ports)
}
func (c *containerContext) Status() string {
@ -257,3 +257,89 @@ func (c *containerContext) Networks() string {
return strings.Join(networks, ",")
}
// DisplayablePorts returns formatted string representing open ports of container
// e.g. "0.0.0.0:80->9090/tcp, 9988/tcp"
// it's used by command 'docker ps'
func DisplayablePorts(ports []types.Port) string {
type portGroup struct {
first uint16
last uint16
}
groupMap := make(map[string]*portGroup)
var result []string
var hostMappings []string
var groupMapKeys []string
sort.Sort(byPortInfo(ports))
for _, port := range ports {
current := port.PrivatePort
portKey := port.Type
if port.IP != "" {
if port.PublicPort != current {
hostMappings = append(hostMappings, fmt.Sprintf("%s:%d->%d/%s", port.IP, port.PublicPort, port.PrivatePort, port.Type))
continue
}
portKey = fmt.Sprintf("%s/%s", port.IP, port.Type)
}
group := groupMap[portKey]
if group == nil {
groupMap[portKey] = &portGroup{first: current, last: current}
// record order that groupMap keys are created
groupMapKeys = append(groupMapKeys, portKey)
continue
}
if current == (group.last + 1) {
group.last = current
continue
}
result = append(result, formGroup(portKey, group.first, group.last))
groupMap[portKey] = &portGroup{first: current, last: current}
}
for _, portKey := range groupMapKeys {
g := groupMap[portKey]
result = append(result, formGroup(portKey, g.first, g.last))
}
result = append(result, hostMappings...)
return strings.Join(result, ", ")
}
func formGroup(key string, start, last uint16) string {
parts := strings.Split(key, "/")
groupType := parts[0]
var ip string
if len(parts) > 1 {
ip = parts[0]
groupType = parts[1]
}
group := strconv.Itoa(int(start))
if start != last {
group = fmt.Sprintf("%s-%d", group, last)
}
if ip != "" {
group = fmt.Sprintf("%s:%s->%s", ip, group, group)
}
return fmt.Sprintf("%s/%s", group, groupType)
}
// byPortInfo is a temporary type used to sort types.Port by its fields
type byPortInfo []types.Port
func (r byPortInfo) Len() int { return len(r) }
func (r byPortInfo) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
func (r byPortInfo) Less(i, j int) bool {
if r[i].PrivatePort != r[j].PrivatePort {
return r[i].PrivatePort < r[j].PrivatePort
}
if r[i].IP != r[j].IP {
return r[i].IP < r[j].IP
}
if r[i].PublicPort != r[j].PublicPort {
return r[i].PublicPort < r[j].PublicPort
}
return r[i].Type < r[j].Type
}

View File

@ -11,6 +11,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestContainerPsContext(t *testing.T) {
@ -226,7 +227,7 @@ size: 0B
Context{Format: NewContainerFormat("{{.Image}}", false, true)},
"ubuntu\nubuntu\n",
},
// Special headers for customerized table format
// Special headers for customized table format
{
Context{Format: NewContainerFormat(`table {{truncate .ID 5}}\t{{json .Image}} {{.RunningFor}}/{{title .Status}}/{{pad .Ports 2 2}}.{{upper .Names}} {{lower .Status}}`, false, true)},
`CONTAINER ID IMAGE CREATED/STATUS/ PORTS .NAMES STATUS
@ -357,12 +358,11 @@ func TestContainerContextWriteJSON(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var m map[string]interface{}
if err := json.Unmarshal([]byte(line), &m); err != nil {
t.Fatal(err)
}
assert.Equal(t, expectedJSONs[i], m)
err := json.Unmarshal([]byte(line), &m)
require.NoError(t, err, msg)
assert.Equal(t, expectedJSONs[i], m, msg)
}
}
@ -377,12 +377,11 @@ func TestContainerContextWriteJSONField(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var s string
if err := json.Unmarshal([]byte(line), &s); err != nil {
t.Fatal(err)
}
assert.Equal(t, containers[i].ID, s)
err := json.Unmarshal([]byte(line), &s)
require.NoError(t, err, msg)
assert.Equal(t, containers[i].ID, s, msg)
}
}
@ -411,3 +410,248 @@ func TestContainerBackCompat(t *testing.T) {
buf.Reset()
}
}
type ports struct {
ports []types.Port
expected string
}
// nolint: lll
func TestDisplayablePorts(t *testing.T) {
cases := []ports{
{
[]types.Port{
{
PrivatePort: 9988,
Type: "tcp",
},
},
"9988/tcp"},
{
[]types.Port{
{
PrivatePort: 9988,
Type: "udp",
},
},
"9988/udp",
},
{
[]types.Port{
{
IP: "0.0.0.0",
PrivatePort: 9988,
Type: "tcp",
},
},
"0.0.0.0:0->9988/tcp",
},
{
[]types.Port{
{
PrivatePort: 9988,
PublicPort: 8899,
Type: "tcp",
},
},
"9988/tcp",
},
{
[]types.Port{
{
IP: "4.3.2.1",
PrivatePort: 9988,
PublicPort: 8899,
Type: "tcp",
},
},
"4.3.2.1:8899->9988/tcp",
},
{
[]types.Port{
{
IP: "4.3.2.1",
PrivatePort: 9988,
PublicPort: 9988,
Type: "tcp",
},
},
"4.3.2.1:9988->9988/tcp",
},
{
[]types.Port{
{
PrivatePort: 9988,
Type: "udp",
}, {
PrivatePort: 9988,
Type: "udp",
},
},
"9988/udp, 9988/udp",
},
{
[]types.Port{
{
IP: "1.2.3.4",
PublicPort: 9998,
PrivatePort: 9998,
Type: "udp",
}, {
IP: "1.2.3.4",
PublicPort: 9999,
PrivatePort: 9999,
Type: "udp",
},
},
"1.2.3.4:9998-9999->9998-9999/udp",
},
{
[]types.Port{
{
IP: "1.2.3.4",
PublicPort: 8887,
PrivatePort: 9998,
Type: "udp",
}, {
IP: "1.2.3.4",
PublicPort: 8888,
PrivatePort: 9999,
Type: "udp",
},
},
"1.2.3.4:8887->9998/udp, 1.2.3.4:8888->9999/udp",
},
{
[]types.Port{
{
PrivatePort: 9998,
Type: "udp",
}, {
PrivatePort: 9999,
Type: "udp",
},
},
"9998-9999/udp",
},
{
[]types.Port{
{
IP: "1.2.3.4",
PrivatePort: 6677,
PublicPort: 7766,
Type: "tcp",
}, {
PrivatePort: 9988,
PublicPort: 8899,
Type: "udp",
},
},
"9988/udp, 1.2.3.4:7766->6677/tcp",
},
{
[]types.Port{
{
IP: "1.2.3.4",
PrivatePort: 9988,
PublicPort: 8899,
Type: "udp",
}, {
IP: "1.2.3.4",
PrivatePort: 9988,
PublicPort: 8899,
Type: "tcp",
}, {
IP: "4.3.2.1",
PrivatePort: 2233,
PublicPort: 3322,
Type: "tcp",
},
},
"4.3.2.1:3322->2233/tcp, 1.2.3.4:8899->9988/tcp, 1.2.3.4:8899->9988/udp",
},
{
[]types.Port{
{
PrivatePort: 9988,
PublicPort: 8899,
Type: "udp",
}, {
IP: "1.2.3.4",
PrivatePort: 6677,
PublicPort: 7766,
Type: "tcp",
}, {
IP: "4.3.2.1",
PrivatePort: 2233,
PublicPort: 3322,
Type: "tcp",
},
},
"9988/udp, 4.3.2.1:3322->2233/tcp, 1.2.3.4:7766->6677/tcp",
},
{
[]types.Port{
{
PrivatePort: 80,
Type: "tcp",
}, {
PrivatePort: 1024,
Type: "tcp",
}, {
PrivatePort: 80,
Type: "udp",
}, {
PrivatePort: 1024,
Type: "udp",
}, {
IP: "1.1.1.1",
PublicPort: 80,
PrivatePort: 1024,
Type: "tcp",
}, {
IP: "1.1.1.1",
PublicPort: 80,
PrivatePort: 1024,
Type: "udp",
}, {
IP: "1.1.1.1",
PublicPort: 1024,
PrivatePort: 80,
Type: "tcp",
}, {
IP: "1.1.1.1",
PublicPort: 1024,
PrivatePort: 80,
Type: "udp",
}, {
IP: "2.1.1.1",
PublicPort: 80,
PrivatePort: 1024,
Type: "tcp",
}, {
IP: "2.1.1.1",
PublicPort: 80,
PrivatePort: 1024,
Type: "udp",
}, {
IP: "2.1.1.1",
PublicPort: 1024,
PrivatePort: 80,
Type: "tcp",
}, {
IP: "2.1.1.1",
PublicPort: 1024,
PrivatePort: 80,
Type: "udp",
},
},
"80/tcp, 80/udp, 1024/tcp, 1024/udp, 1.1.1.1:1024->80/tcp, 1.1.1.1:1024->80/udp, 2.1.1.1:1024->80/tcp, 2.1.1.1:1024->80/udp, 1.1.1.1:80->1024/tcp, 1.1.1.1:80->1024/udp, 2.1.1.1:80->1024/tcp, 2.1.1.1:80->1024/udp",
},
}
for _, port := range cases {
actual := DisplayablePorts(port.ports)
assert.Equal(t, port.expected, actual)
}
}

View File

@ -29,11 +29,12 @@ const (
// DiskUsageContext contains disk usage specific information required by the formatter, encapsulate a Context struct.
type DiskUsageContext struct {
Context
Verbose bool
LayersSize int64
Images []*types.ImageSummary
Containers []*types.Container
Volumes []*types.Volume
Verbose bool
LayersSize int64
Images []*types.ImageSummary
Containers []*types.Container
Volumes []*types.Volume
BuilderSize int64
}
func (ctx *DiskUsageContext) startSubsection(format string) (*template.Template, error) {
@ -65,49 +66,59 @@ reclaimable: {{.Reclaimable}}
}
func (ctx *DiskUsageContext) Write() (err error) {
if ctx.Verbose == false {
ctx.buffer = bytes.NewBufferString("")
ctx.preFormat()
tmpl, err := ctx.parseFormat()
if err != nil {
return err
}
err = ctx.contextFormat(tmpl, &diskUsageImagesContext{
totalSize: ctx.LayersSize,
images: ctx.Images,
})
if err != nil {
return err
}
err = ctx.contextFormat(tmpl, &diskUsageContainersContext{
containers: ctx.Containers,
})
if err != nil {
return err
}
err = ctx.contextFormat(tmpl, &diskUsageVolumesContext{
volumes: ctx.Volumes,
})
if err != nil {
return err
}
diskUsageContainersCtx := diskUsageContainersContext{containers: []*types.Container{}}
diskUsageContainersCtx.header = map[string]string{
"Type": typeHeader,
"TotalCount": totalHeader,
"Active": activeHeader,
"Size": sizeHeader,
"Reclaimable": reclaimableHeader,
}
ctx.postFormat(tmpl, &diskUsageContainersCtx)
if ctx.Verbose {
return ctx.verboseWrite()
}
ctx.buffer = bytes.NewBufferString("")
ctx.preFormat()
tmpl, err := ctx.parseFormat()
if err != nil {
return err
}
err = ctx.contextFormat(tmpl, &diskUsageImagesContext{
totalSize: ctx.LayersSize,
images: ctx.Images,
})
if err != nil {
return err
}
err = ctx.contextFormat(tmpl, &diskUsageContainersContext{
containers: ctx.Containers,
})
if err != nil {
return err
}
err = ctx.contextFormat(tmpl, &diskUsageVolumesContext{
volumes: ctx.Volumes,
})
if err != nil {
return err
}
err = ctx.contextFormat(tmpl, &diskUsageBuilderContext{
builderSize: ctx.BuilderSize,
})
if err != nil {
return err
}
diskUsageContainersCtx := diskUsageContainersContext{containers: []*types.Container{}}
diskUsageContainersCtx.header = map[string]string{
"Type": typeHeader,
"TotalCount": totalHeader,
"Active": activeHeader,
"Size": sizeHeader,
"Reclaimable": reclaimableHeader,
}
ctx.postFormat(tmpl, &diskUsageContainersCtx)
return err
}
func (ctx *DiskUsageContext) verboseWrite() (err error) {
// First images
tmpl, err := ctx.startSubsection(defaultDiskUsageImageTableFormat)
if err != nil {
@ -176,6 +187,9 @@ func (ctx *DiskUsageContext) Write() (err error) {
}
}
ctx.postFormat(tmpl, newVolumeContext())
// And build cache
fmt.Fprintf(ctx.Output, "\nBuild cache usage: %s\n\n", units.HumanSize(float64(ctx.BuilderSize)))
return
}
@ -229,12 +243,11 @@ func (c *diskUsageImagesContext) Reclaimable() string {
if c.totalSize > 0 {
return fmt.Sprintf("%s (%v%%)", units.HumanSize(float64(reclaimable)), (reclaimable*100)/c.totalSize)
}
return fmt.Sprintf("%s", units.HumanSize(float64(reclaimable)))
return units.HumanSize(float64(reclaimable))
}
type diskUsageContainersContext struct {
HeaderContext
verbose bool
containers []*types.Container
}
@ -292,12 +305,11 @@ func (c *diskUsageContainersContext) Reclaimable() string {
return fmt.Sprintf("%s (%v%%)", units.HumanSize(float64(reclaimable)), (reclaimable*100)/totalSize)
}
return fmt.Sprintf("%s", units.HumanSize(float64(reclaimable)))
return units.HumanSize(float64(reclaimable))
}
type diskUsageVolumesContext struct {
HeaderContext
verbose bool
volumes []*types.Volume
}
@ -354,5 +366,34 @@ func (c *diskUsageVolumesContext) Reclaimable() string {
return fmt.Sprintf("%s (%v%%)", units.HumanSize(float64(reclaimable)), (reclaimable*100)/totalSize)
}
return fmt.Sprintf("%s", units.HumanSize(float64(reclaimable)))
return units.HumanSize(float64(reclaimable))
}
type diskUsageBuilderContext struct {
HeaderContext
builderSize int64
}
func (c *diskUsageBuilderContext) MarshalJSON() ([]byte, error) {
return marshalJSON(c)
}
func (c *diskUsageBuilderContext) Type() string {
return "Build Cache"
}
func (c *diskUsageBuilderContext) TotalCount() string {
return ""
}
func (c *diskUsageBuilderContext) Active() string {
return ""
}
func (c *diskUsageBuilderContext) Size() string {
return units.HumanSize(float64(c.builderSize))
}
func (c *diskUsageBuilderContext) Reclaimable() string {
return c.Size()
}

View File

@ -23,6 +23,7 @@ func TestDiskUsageContextFormatWrite(t *testing.T) {
Images 0 0 0B 0B
Containers 0 0 0B 0B
Local Volumes 0 0 0B 0B
Build Cache 0B 0B
`,
},
{
@ -38,6 +39,9 @@ CONTAINER ID IMAGE COMMAND LOCAL VOLUMES
Local Volumes space usage:
VOLUME NAME LINKS SIZE
Build cache usage: 0B
`,
},
// Errors
@ -70,6 +74,7 @@ VOLUME NAME LINKS SIZE
Images 0 0 0B 0B
Containers 0 0 0B 0B
Local Volumes 0 0 0B 0B
Build Cache 0B 0B
`,
},
{
@ -82,6 +87,7 @@ Local Volumes 0 0 0B
Images 0
Containers 0
Local Volumes 0
Build Cache
`,
},
// Raw Format
@ -109,6 +115,12 @@ active: 0
size: 0B
reclaimable: 0B
type: Build Cache
total:
active:
size: 0B
reclaimable: 0B
`,
},
}

View File

@ -79,21 +79,18 @@ func (c *historyContext) ID() string {
}
func (c *historyContext) CreatedAt() string {
var created string
created = units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(c.h.Created), 0)))
return created
return units.HumanDuration(time.Now().UTC().Sub(time.Unix(c.h.Created, 0)))
}
func (c *historyContext) CreatedSince() string {
var created string
created = units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(c.h.Created), 0)))
created := units.HumanDuration(time.Now().UTC().Sub(time.Unix(c.h.Created, 0)))
return created + " ago"
}
func (c *historyContext) CreatedBy() string {
createdBy := strings.Replace(c.h.CreatedBy, "\t", " ", -1)
if c.trunc {
createdBy = stringutils.Ellipsis(createdBy, 45)
return stringutils.Ellipsis(createdBy, 45)
}
return createdBy
}

View File

@ -234,12 +234,12 @@ func (c *imageContext) Digest() string {
}
func (c *imageContext) CreatedSince() string {
createdAt := time.Unix(int64(c.i.Created), 0)
createdAt := time.Unix(c.i.Created, 0)
return units.HumanDuration(time.Now().UTC().Sub(createdAt)) + " ago"
}
func (c *imageContext) CreatedAt() string {
return time.Unix(int64(c.i.Created), 0).String()
return time.Unix(c.i.Created, 0).String()
}
func (c *imageContext) Size() string {

View File

@ -3,6 +3,7 @@ package formatter
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"testing"
"time"
@ -10,6 +11,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNetworkContext(t *testing.T) {
@ -183,12 +185,11 @@ func TestNetworkContextWriteJSON(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var m map[string]interface{}
if err := json.Unmarshal([]byte(line), &m); err != nil {
t.Fatal(err)
}
assert.Equal(t, expectedJSONs[i], m)
err := json.Unmarshal([]byte(line), &m)
require.NoError(t, err, msg)
assert.Equal(t, expectedJSONs[i], m, msg)
}
}
@ -203,11 +204,10 @@ func TestNetworkContextWriteJSONField(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var s string
if err := json.Unmarshal([]byte(line), &s); err != nil {
t.Fatal(err)
}
assert.Equal(t, networks[i].ID, s)
err := json.Unmarshal([]byte(line), &s)
require.NoError(t, err, msg)
assert.Equal(t, networks[i].ID, s, msg)
}
}

View File

@ -3,6 +3,7 @@ package formatter
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"testing"
@ -10,6 +11,7 @@ import (
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/pkg/stringid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNodeContext(t *testing.T) {
@ -248,12 +250,11 @@ func TestNodeContextWriteJSON(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var m map[string]interface{}
if err := json.Unmarshal([]byte(line), &m); err != nil {
t.Fatal(err)
}
assert.Equal(t, testcase.expected[i], m)
err := json.Unmarshal([]byte(line), &m)
require.NoError(t, err, msg)
assert.Equal(t, testcase.expected[i], m, msg)
}
}
}
@ -269,12 +270,11 @@ func TestNodeContextWriteJSONField(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var s string
if err := json.Unmarshal([]byte(line), &s); err != nil {
t.Fatal(err)
}
assert.Equal(t, nodes[i].ID, s)
err := json.Unmarshal([]byte(line), &s)
require.NoError(t, err, msg)
assert.Equal(t, nodes[i].ID, s, msg)
}
}

View File

@ -12,7 +12,7 @@ func (d *dummy) Func1() string {
return "Func1"
}
func (d *dummy) func2() string {
func (d *dummy) func2() string { // nolint: unused
return "func2(should not be marshalled)"
}

View File

@ -3,11 +3,13 @@ package formatter
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"testing"
"github.com/docker/docker/api/types/swarm"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestServiceContextWrite(t *testing.T) {
@ -200,12 +202,11 @@ func TestServiceContextWriteJSON(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var m map[string]interface{}
if err := json.Unmarshal([]byte(line), &m); err != nil {
t.Fatal(err)
}
assert.Equal(t, expectedJSONs[i], m)
err := json.Unmarshal([]byte(line), &m)
require.NoError(t, err, msg)
assert.Equal(t, expectedJSONs[i], m, msg)
}
}
func TestServiceContextWriteJSONField(t *testing.T) {
@ -229,11 +230,10 @@ func TestServiceContextWriteJSONField(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var s string
if err := json.Unmarshal([]byte(line), &s); err != nil {
t.Fatal(err)
}
assert.Equal(t, services[i].Spec.Name, s)
err := json.Unmarshal([]byte(line), &s)
require.NoError(t, err, msg)
assert.Equal(t, services[i].Spec.Name, s, msg)
}
}

View File

@ -109,10 +109,8 @@ func NewStatsFormat(source, osType string) Format {
}
// NewContainerStats returns a new ContainerStats entity and sets in it the given name
func NewContainerStats(container, osType string) *ContainerStats {
return &ContainerStats{
StatsEntry: StatsEntry{Container: container},
}
func NewContainerStats(container string) *ContainerStats {
return &ContainerStats{StatsEntry: StatsEntry{Container: container}}
}
// ContainerStatsWrite renders the context for a list of containers statistics
@ -186,7 +184,7 @@ func (c *containerStatsContext) MemUsage() string {
return fmt.Sprintf("-- / --")
}
if c.os == winOSType {
return fmt.Sprintf("%s", units.BytesSize(c.s.Memory))
return units.BytesSize(c.s.Memory)
}
return fmt.Sprintf("%s / %s", units.BytesSize(c.s.Memory), units.BytesSize(c.s.MemoryLimit))
}

View File

@ -3,12 +3,14 @@ package formatter
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"testing"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/stringid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestVolumeContext(t *testing.T) {
@ -153,12 +155,11 @@ func TestVolumeContextWriteJSON(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var m map[string]interface{}
if err := json.Unmarshal([]byte(line), &m); err != nil {
t.Fatal(err)
}
assert.Equal(t, expectedJSONs[i], m)
err := json.Unmarshal([]byte(line), &m)
require.NoError(t, err, msg)
assert.Equal(t, expectedJSONs[i], m, msg)
}
}
@ -173,11 +174,10 @@ func TestVolumeContextWriteJSONField(t *testing.T) {
t.Fatal(err)
}
for i, line := range strings.Split(strings.TrimSpace(out.String()), "\n") {
t.Logf("Output: line %d: %s", i, line)
msg := fmt.Sprintf("Output: line %d: %s", i, line)
var s string
if err := json.Unmarshal([]byte(line), &s); err != nil {
t.Fatal(err)
}
assert.Equal(t, volumes[i].Name, s)
err := json.Unmarshal([]byte(line), &s)
require.NoError(t, err, msg)
assert.Equal(t, volumes[i].Name, s, msg)
}
}

View File

@ -12,6 +12,7 @@ import (
"regexp"
"runtime"
"github.com/Sirupsen/logrus"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/image/build"
@ -25,7 +26,6 @@ import (
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
"github.com/docker/docker/pkg/urlutil"
runconfigopts "github.com/docker/docker/runconfig/opts"
units "github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@ -62,6 +62,7 @@ type buildOptions struct {
squash bool
target string
imageIDFile string
stream bool
}
// dockerfileFromStdin returns true when the user specified that the Dockerfile
@ -76,16 +77,20 @@ func (o buildOptions) contextFromStdin() bool {
return o.context == "-"
}
// NewBuildCommand creates a new `docker build` command
func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
func newBuildOptions() buildOptions {
ulimits := make(map[string]*units.Ulimit)
options := buildOptions{
return buildOptions{
tags: opts.NewListOpts(validateTag),
buildArgs: opts.NewListOpts(opts.ValidateEnv),
ulimits: opts.NewUlimitOpt(&ulimits),
labels: opts.NewListOpts(opts.ValidateEnv),
extraHosts: opts.NewListOpts(opts.ValidateExtraHost),
}
}
// NewBuildCommand creates a new `docker build` command
func NewBuildCommand(dockerCli command.Cli) *cobra.Command {
options := newBuildOptions()
cmd := &cobra.Command{
Use: "build [OPTIONS] PATH | URL | -",
@ -134,6 +139,10 @@ func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
flags.SetAnnotation("squash", "experimental", nil)
flags.SetAnnotation("squash", "version", []string{"1.25"})
flags.BoolVar(&options.stream, "stream", false, "Stream attaches to server to negotiate build context")
flags.SetAnnotation("stream", "experimental", nil)
flags.SetAnnotation("stream", "version", []string{"1.31"})
return cmd
}
@ -154,7 +163,7 @@ func (out *lastProgressOutput) WriteProgress(prog progress.Progress) error {
}
// nolint: gocyclo
func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
func runBuild(dockerCli command.Cli, options buildOptions) error {
var (
buildCtx io.ReadCloser
dockerfileCtx io.ReadCloser
@ -164,6 +173,7 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
relDockerfile string
progBuff io.Writer
buildBuff io.Writer
remote string
)
if options.dockerfileFromStdin() {
@ -189,6 +199,7 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
switch {
case options.contextFromStdin():
// buildCtx is tar archive. if stdin was dockerfile then it is wrapped
buildCtx, relDockerfile, err = build.GetContextFromReader(dockerCli.In(), options.dockerfileName)
case isLocalDir(specifiedContext):
contextDir, relDockerfile, err = build.GetContextFromLocalDir(specifiedContext, options.dockerfileName)
@ -212,7 +223,8 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
contextDir = tempDir
}
if buildCtx == nil {
// read from a directory into tar archive
if buildCtx == nil && !options.stream {
excludes, err := build.ReadDockerignore(contextDir)
if err != nil {
return err
@ -229,13 +241,7 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
}
excludes = build.TrimBuildFilesFromExcludes(excludes, relDockerfile, options.dockerfileFromStdin())
compression := archive.Uncompressed
if options.compress {
compression = archive.Gzip
}
buildCtx, err = archive.TarWithOptions(contextDir, &archive.TarOptions{
Compression: compression,
ExcludePatterns: excludes,
})
if err != nil {
@ -243,24 +249,52 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
}
}
// replace Dockerfile if added dynamically
if dockerfileCtx != nil {
// replace Dockerfile if it was added from stdin and there is archive context
if dockerfileCtx != nil && buildCtx != nil {
buildCtx, relDockerfile, err = build.AddDockerfileToBuildContext(dockerfileCtx, buildCtx)
if err != nil {
return err
}
}
ctx := context.Background()
// if streaming and dockerfile was not from stdin then read from file
// to the same reader that is usually stdin
if options.stream && dockerfileCtx == nil {
dockerfileCtx, err = os.Open(relDockerfile)
if err != nil {
return errors.Wrapf(err, "failed to open %s", relDockerfile)
}
defer dockerfileCtx.Close()
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var resolvedTags []*resolvedTag
if command.IsTrusted() {
translator := func(ctx context.Context, ref reference.NamedTagged) (reference.Canonical, error) {
return TrustedReference(ctx, dockerCli, ref, nil)
}
// Wrap the tar archive to replace the Dockerfile entry with the rewritten
// Dockerfile which uses trusted pulls.
buildCtx = replaceDockerfileTarWrapper(ctx, buildCtx, relDockerfile, translator, &resolvedTags)
// if there is a tar wrapper, the dockerfile needs to be replaced inside it
if buildCtx != nil {
// Wrap the tar archive to replace the Dockerfile entry with the rewritten
// Dockerfile which uses trusted pulls.
buildCtx = replaceDockerfileTarWrapper(ctx, buildCtx, relDockerfile, translator, &resolvedTags)
} else if dockerfileCtx != nil {
// if there was not archive context still do the possible replacements in Dockerfile
newDockerfile, _, err := rewriteDockerfileFrom(ctx, dockerfileCtx, translator)
if err != nil {
return err
}
dockerfileCtx = ioutil.NopCloser(bytes.NewBuffer(newDockerfile))
}
}
if options.compress {
buildCtx, err = build.Compress(buildCtx)
if err != nil {
return err
}
}
// Setup an upload progress bar
@ -269,9 +303,46 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
progressOutput = &lastProgressOutput{output: progressOutput}
}
var body io.Reader = progress.NewProgressReader(buildCtx, progressOutput, 0, "", "Sending build context to Docker daemon")
// if up to this point nothing has set the context then we must have have
// another way for sending it(streaming) and set the context to the Dockerfile
if dockerfileCtx != nil && buildCtx == nil {
buildCtx = dockerfileCtx
}
authConfigs, _ := dockerCli.GetAllCredentials()
s, err := trySession(dockerCli, contextDir)
if err != nil {
return err
}
var body io.Reader
if buildCtx != nil && !options.stream {
body = progress.NewProgressReader(buildCtx, progressOutput, 0, "", "Sending build context to Docker daemon")
}
// add context stream to the session
if options.stream && s != nil {
syncDone := make(chan error) // used to signal first progress reporting completed.
// progress would also send errors but don't need it here as errors
// are handled by session.Run() and ImageBuild()
if err := addDirToSession(s, contextDir, progressOutput, syncDone); err != nil {
return err
}
buf := newBufferedWriter(syncDone, buildBuff)
defer func() {
select {
case <-buf.flushed:
case <-ctx.Done():
}
}()
buildBuff = buf
remote = clientSessionRemote
body = buildCtx
}
configFile := dockerCli.ConfigFile()
authConfigs, _ := configFile.GetAllCredentials()
buildOptions := types.ImageBuildOptions{
Memory: options.memory.Value(),
MemorySwap: options.memorySwap.Value(),
@ -291,15 +362,27 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
Dockerfile: relDockerfile,
ShmSize: options.shmSize.Value(),
Ulimits: options.ulimits.GetList(),
BuildArgs: runconfigopts.ConvertKVStringsToMapWithNil(options.buildArgs.GetAll()),
BuildArgs: configFile.ParseProxyConfig(dockerCli.Client().DaemonHost(), options.buildArgs.GetAll()),
AuthConfigs: authConfigs,
Labels: runconfigopts.ConvertKVStringsToMap(options.labels.GetAll()),
Labels: opts.ConvertKVStringsToMap(options.labels.GetAll()),
CacheFrom: options.cacheFrom,
SecurityOpt: options.securityOpt,
NetworkMode: options.networkMode,
Squash: options.squash,
ExtraHosts: options.extraHosts.GetAll(),
Target: options.target,
RemoteContext: remote,
}
if s != nil {
go func() {
logrus.Debugf("running session: %v", s.UUID())
if err := s.Run(ctx, dockerCli.Client().DialSession); err != nil {
logrus.Error(err)
cancel() // cancel progress context
}
}()
buildOptions.SessionID = s.UUID()
}
response, err := dockerCli.Client().ImageBuild(ctx, body, buildOptions)
@ -307,6 +390,7 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
if options.quiet {
fmt.Fprintf(dockerCli.Err(), "%s", progBuff)
}
cancel()
return err
}
defer response.Body.Close()

View File

@ -1,25 +1,25 @@
package build
import (
"archive/tar"
"bufio"
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"archive/tar"
"bytes"
"time"
"github.com/docker/docker/builder/remotecontext/git"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/gitutils"
"github.com/docker/docker/pkg/httputils"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
"github.com/docker/docker/pkg/stringid"
@ -29,6 +29,8 @@ import (
const (
// DefaultDockerfileName is the Default filename with Docker commands, read by docker build
DefaultDockerfileName string = "Dockerfile"
// archiveHeaderSize is the number of bytes in an archive header
archiveHeaderSize = 512
)
// ValidateContextDirectory checks if all the contents of the directory
@ -85,12 +87,12 @@ func ValidateContextDirectory(srcPath string, excludes []string) error {
func GetContextFromReader(r io.ReadCloser, dockerfileName string) (out io.ReadCloser, relDockerfile string, err error) {
buf := bufio.NewReader(r)
magic, err := buf.Peek(archive.HeaderSize)
magic, err := buf.Peek(archiveHeaderSize)
if err != nil && err != io.EOF {
return nil, "", errors.Errorf("failed to peek context header from STDIN: %v", err)
}
if archive.IsArchive(magic) {
if IsArchive(magic) {
return ioutils.NewReadCloserWrapper(buf, func() error { return r.Close() }), dockerfileName, nil
}
@ -134,6 +136,18 @@ func GetContextFromReader(r io.ReadCloser, dockerfileName string) (out io.ReadCl
}
// IsArchive checks for the magic bytes of a tar or any supported compression
// algorithm.
func IsArchive(header []byte) bool {
compression := archive.DetectCompression(header)
if compression != archive.Uncompressed {
return true
}
r := tar.NewReader(bytes.NewBuffer(header))
_, err := r.Next()
return err == nil
}
// GetContextFromGitURL uses a Git URL as context for a `docker build`. The
// git repo is cloned into a temporary directory used as the context directory.
// Returns the absolute path to the temporary context directory, the relative
@ -143,7 +157,7 @@ func GetContextFromGitURL(gitURL, dockerfileName string) (string, string, error)
if _, err := exec.LookPath("git"); err != nil {
return "", "", errors.Wrapf(err, "unable to find 'git'")
}
absContextDir, err := gitutils.Clone(gitURL)
absContextDir, err := git.Clone(gitURL)
if err != nil {
return "", "", errors.Wrapf(err, "unable to 'git clone' to temporary context directory")
}
@ -161,7 +175,7 @@ func GetContextFromGitURL(gitURL, dockerfileName string) (string, string, error)
// Returns the tar archive used for the context and a path of the
// dockerfile inside the tar.
func GetContextFromURL(out io.Writer, remoteURL, dockerfileName string) (io.ReadCloser, string, error) {
response, err := httputils.Download(remoteURL)
response, err := getWithStatusError(remoteURL)
if err != nil {
return nil, "", errors.Errorf("unable to download remote context %s: %v", remoteURL, err)
}
@ -173,6 +187,24 @@ func GetContextFromURL(out io.Writer, remoteURL, dockerfileName string) (io.Read
return GetContextFromReader(ioutils.NewReadCloserWrapper(progReader, func() error { return response.Body.Close() }), dockerfileName)
}
// getWithStatusError does an http.Get() and returns an error if the
// status code is 4xx or 5xx.
func getWithStatusError(url string) (resp *http.Response, err error) {
if resp, err = http.Get(url); err != nil {
return nil, err
}
if resp.StatusCode < 400 {
return resp, nil
}
msg := fmt.Sprintf("failed to GET %s with status %s", url, resp.Status)
body, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
return nil, errors.Wrapf(err, msg+": error reading body")
}
return nil, errors.Errorf(msg+": %s", bytes.TrimSpace(body))
}
// GetContextFromLocalDir uses the given local directory as context for a
// `docker build`. Returns the absolute path to the local context directory,
// the relative path of the dockerfile in that context directory, and a non-nil
@ -344,3 +376,27 @@ func AddDockerfileToBuildContext(dockerfileCtx io.ReadCloser, buildCtx io.ReadCl
})
return buildCtx, randomName, nil
}
// Compress the build context for sending to the API
func Compress(buildCtx io.ReadCloser) (io.ReadCloser, error) {
pipeReader, pipeWriter := io.Pipe()
go func() {
compressWriter, err := archive.CompressStream(pipeWriter, archive.Gzip)
if err != nil {
pipeWriter.CloseWithError(err)
}
defer buildCtx.Close()
if _, err := pools.Copy(compressWriter, buildCtx); err != nil {
pipeWriter.CloseWithError(
errors.Wrap(err, "failed to compress context"))
compressWriter.Close()
return
}
compressWriter.Close()
pipeWriter.Close()
}()
return pipeReader, nil
}

View File

@ -266,3 +266,35 @@ func chdir(t *testing.T, dir string) func() {
require.NoError(t, os.Chdir(dir))
return func() { require.NoError(t, os.Chdir(workingDirectory)) }
}
func TestIsArchive(t *testing.T) {
var testcases = []struct {
doc string
header []byte
expected bool
}{
{
doc: "nil is not a valid header",
header: nil,
expected: false,
},
{
doc: "invalid header bytes",
header: []byte{0x00, 0x01, 0x02},
expected: false,
},
{
doc: "header for bzip2 archive",
header: []byte{0x42, 0x5A, 0x68},
expected: true,
},
{
doc: "header for 7zip archive is not supported",
header: []byte{0x50, 0x4b, 0x03, 0x04},
expected: false,
},
}
for _, testcase := range testcases {
assert.Equal(t, testcase.expected, IsArchive(testcase.header), testcase.doc)
}
}

View File

@ -0,0 +1,151 @@
package image
import (
"bytes"
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"sync"
"time"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/image/build"
cliconfig "github.com/docker/cli/cli/config"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client/session"
"github.com/docker/docker/client/session/filesync"
"github.com/docker/docker/pkg/progress"
"github.com/pkg/errors"
"golang.org/x/time/rate"
)
const clientSessionRemote = "client-session"
func isSessionSupported(dockerCli command.Cli) bool {
return dockerCli.ServerInfo().HasExperimental && versions.GreaterThanOrEqualTo(dockerCli.Client().ClientVersion(), "1.31")
}
func trySession(dockerCli command.Cli, contextDir string) (*session.Session, error) {
var s *session.Session
if isSessionSupported(dockerCli) {
sharedKey, err := getBuildSharedKey(contextDir)
if err != nil {
return nil, errors.Wrap(err, "failed to get build shared key")
}
s, err = session.NewSession(filepath.Base(contextDir), sharedKey)
if err != nil {
return nil, errors.Wrap(err, "failed to create session")
}
}
return s, nil
}
func addDirToSession(session *session.Session, contextDir string, progressOutput progress.Output, done chan error) error {
excludes, err := build.ReadDockerignore(contextDir)
if err != nil {
return err
}
p := &sizeProgress{out: progressOutput, action: "Streaming build context to Docker daemon"}
workdirProvider := filesync.NewFSSyncProvider(contextDir, excludes)
session.Allow(workdirProvider)
// this will be replaced on parallel build jobs. keep the current
// progressbar for now
if snpc, ok := workdirProvider.(interface {
SetNextProgressCallback(func(int, bool), chan error)
}); ok {
snpc.SetNextProgressCallback(p.update, done)
}
return nil
}
type sizeProgress struct {
out progress.Output
action string
limiter *rate.Limiter
}
func (sp *sizeProgress) update(size int, last bool) {
if sp.limiter == nil {
sp.limiter = rate.NewLimiter(rate.Every(100*time.Millisecond), 1)
}
if last || sp.limiter.Allow() {
sp.out.WriteProgress(progress.Progress{Action: sp.action, Current: int64(size), LastUpdate: last})
}
}
type bufferedWriter struct {
done chan error
io.Writer
buf *bytes.Buffer
flushed chan struct{}
mu sync.Mutex
}
func newBufferedWriter(done chan error, w io.Writer) *bufferedWriter {
bw := &bufferedWriter{done: done, Writer: w, buf: new(bytes.Buffer), flushed: make(chan struct{})}
go func() {
<-done
bw.flushBuffer()
}()
return bw
}
func (bw *bufferedWriter) Write(dt []byte) (int, error) {
select {
case <-bw.done:
bw.flushBuffer()
return bw.Writer.Write(dt)
default:
return bw.buf.Write(dt)
}
}
func (bw *bufferedWriter) flushBuffer() {
bw.mu.Lock()
select {
case <-bw.flushed:
default:
bw.Writer.Write(bw.buf.Bytes())
close(bw.flushed)
}
bw.mu.Unlock()
}
func getBuildSharedKey(dir string) (string, error) {
// build session is hash of build dir with node based randomness
s := sha256.Sum256([]byte(fmt.Sprintf("%s:%s", tryNodeIdentifier(), dir)))
return hex.EncodeToString(s[:]), nil
}
func tryNodeIdentifier() (out string) {
out = cliconfig.Dir() // return config dir as default on permission error
if err := os.MkdirAll(cliconfig.Dir(), 0700); err == nil {
sessionFile := filepath.Join(cliconfig.Dir(), ".buildNodeID")
if _, err := os.Lstat(sessionFile); err != nil {
if os.IsNotExist(err) { // create a new file with stored randomness
b := make([]byte, 32)
if _, err := rand.Read(b); err != nil {
return
}
if err := ioutil.WriteFile(sessionFile, []byte(hex.EncodeToString(b)), 0600); err != nil {
return
}
}
}
dt, err := ioutil.ReadFile(sessionFile)
if err == nil {
return string(dt)
}
}
return
}

View File

@ -0,0 +1,70 @@
package image
import (
"bytes"
"io"
"io/ioutil"
"os"
"path/filepath"
"sort"
"testing"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/archive"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
)
func TestRunBuildDockerfileFromStdinWithCompress(t *testing.T) {
dest, err := ioutil.TempDir("", "test-build-compress-dest")
require.NoError(t, err)
defer os.RemoveAll(dest)
var dockerfileName string
fakeImageBuild := func(_ context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) {
buffer := new(bytes.Buffer)
tee := io.TeeReader(context, buffer)
assert.NoError(t, archive.Untar(tee, dest, nil))
dockerfileName = options.Dockerfile
header := buffer.Bytes()[:10]
assert.Equal(t, archive.Gzip, archive.DetectCompression(header))
body := new(bytes.Buffer)
return types.ImageBuildResponse{Body: ioutil.NopCloser(body)}, nil
}
cli := test.NewFakeCli(&fakeClient{imageBuildFunc: fakeImageBuild})
dockerfile := bytes.NewBufferString(`
FROM alpine:3.6
COPY foo /
`)
cli.SetIn(command.NewInStream(ioutil.NopCloser(dockerfile)))
dir, err := ioutil.TempDir("", "test-build-compress")
require.NoError(t, err)
defer os.RemoveAll(dir)
ioutil.WriteFile(filepath.Join(dir, "foo"), []byte("some content"), 0644)
options := newBuildOptions()
options.compress = true
options.dockerfileName = "-"
options.context = dir
err = runBuild(cli, options)
require.NoError(t, err)
files, err := ioutil.ReadDir(dest)
require.NoError(t, err)
actual := []string{}
for _, fileInfo := range files {
actual = append(actual, fileInfo.Name())
}
sort.Strings(actual)
assert.Equal(t, []string{dockerfileName, ".dockerignore", "foo"}, actual)
}

View File

@ -27,6 +27,7 @@ type fakeClient struct {
imageInspectFunc func(image string) (types.ImageInspect, []byte, error)
imageImportFunc func(source types.ImageImportSource, ref string, options types.ImageImportOptions) (io.ReadCloser, error)
imageHistoryFunc func(image string) ([]image.HistoryResponseItem, error)
imageBuildFunc func(context.Context, io.Reader, types.ImageBuildOptions) (types.ImageBuildResponse, error)
}
func (cli *fakeClient) ImageTag(_ context.Context, image, ref string) error {
@ -114,3 +115,10 @@ func (cli *fakeClient) ImageHistory(_ context.Context, img string) ([]image.Hist
}
return []image.HistoryResponseItem{{ID: img, Created: time.Now().Unix()}}, nil
}
func (cli *fakeClient) ImageBuild(ctx context.Context, context io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) {
if cli.imageBuildFunc != nil {
return cli.imageBuildFunc(ctx, context, options)
}
return types.ImageBuildResponse{Body: ioutil.NopCloser(strings.NewReader(""))}, nil
}

View File

@ -8,8 +8,7 @@ import (
)
// NewImageCommand returns a cobra command for `image` subcommands
// nolint: interfacer
func NewImageCommand(dockerCli *command.DockerCli) *cobra.Command {
func NewImageCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "image",
Short: "Manage images",

View File

@ -1,7 +1,6 @@
package image
import (
"bytes"
"fmt"
"io/ioutil"
"regexp"
@ -38,8 +37,7 @@ func TestNewHistoryCommandErrors(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewHistoryCommand(test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc}, buf))
cmd := NewHistoryCommand(test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc}))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
@ -90,13 +88,13 @@ func TestNewHistoryCommandSuccess(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewHistoryCommand(test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc}, buf))
cli := test.NewFakeCli(&fakeClient{imageHistoryFunc: tc.imageHistoryFunc})
cmd := NewHistoryCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
err := cmd.Execute()
assert.NoError(t, err)
actual := buf.String()
actual := cli.OutBuffer().String()
if tc.outputRegex == "" {
expected := string(golden.Get(t, []byte(actual), fmt.Sprintf("history-command-success.%s.golden", tc.name))[:])
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, expected)

View File

@ -37,7 +37,7 @@ func TestNewImportCommandErrors(t *testing.T) {
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewImportCommand(test.NewFakeCli(&fakeClient{imageImportFunc: tc.imageImportFunc}, buf))
cmd := NewImportCommand(test.NewFakeCliWithOutput(&fakeClient{imageImportFunc: tc.imageImportFunc}, buf))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
@ -45,7 +45,7 @@ func TestNewImportCommandErrors(t *testing.T) {
}
func TestNewImportCommandInvalidFile(t *testing.T) {
cmd := NewImportCommand(test.NewFakeCli(&fakeClient{}, new(bytes.Buffer)))
cmd := NewImportCommand(test.NewFakeCli(&fakeClient{}))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs([]string{"testdata/import-command-success.unexistent-file"})
testutil.ErrorContains(t, cmd.Execute(), "testdata/import-command-success.unexistent-file")
@ -92,7 +92,7 @@ func TestNewImportCommandSuccess(t *testing.T) {
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewImportCommand(test.NewFakeCli(&fakeClient{imageImportFunc: tc.imageImportFunc}, buf))
cmd := NewImportCommand(test.NewFakeCliWithOutput(&fakeClient{imageImportFunc: tc.imageImportFunc}, buf))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
assert.NoError(t, cmd.Execute())

View File

@ -27,7 +27,7 @@ func TestNewInspectCommandErrors(t *testing.T) {
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newInspectCommand(test.NewFakeCli(&fakeClient{}, buf))
cmd := newInspectCommand(test.NewFakeCliWithOutput(&fakeClient{}, buf))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
@ -79,7 +79,7 @@ func TestNewInspectCommandSuccess(t *testing.T) {
for _, tc := range testCases {
imageInspectInvocationCount = 0
buf := new(bytes.Buffer)
cmd := newInspectCommand(test.NewFakeCli(&fakeClient{imageInspectFunc: tc.imageInspectFunc}, buf))
cmd := newInspectCommand(test.NewFakeCliWithOutput(&fakeClient{imageInspectFunc: tc.imageInspectFunc}, buf))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
err := cmd.Execute()

View File

@ -36,7 +36,7 @@ func TestNewImagesCommandErrors(t *testing.T) {
},
}
for _, tc := range testCases {
cmd := NewImagesCommand(test.NewFakeCli(&fakeClient{imageListFunc: tc.imageListFunc}, new(bytes.Buffer)))
cmd := NewImagesCommand(test.NewFakeCli(&fakeClient{imageListFunc: tc.imageListFunc}))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
@ -81,8 +81,8 @@ func TestNewImagesCommandSuccess(t *testing.T) {
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{imageListFunc: tc.imageListFunc}, buf)
cli.SetConfigfile(&configfile.ConfigFile{ImagesFormat: tc.imageFormat})
cli := test.NewFakeCliWithOutput(&fakeClient{imageListFunc: tc.imageListFunc}, buf)
cli.SetConfigFile(&configfile.ConfigFile{ImagesFormat: tc.imageFormat})
cmd := NewImagesCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
@ -95,7 +95,7 @@ func TestNewImagesCommandSuccess(t *testing.T) {
}
func TestNewListCommandAlias(t *testing.T) {
cmd := newListCommand(test.NewFakeCli(&fakeClient{}, new(bytes.Buffer)))
cmd := newListCommand(test.NewFakeCli(&fakeClient{}))
assert.True(t, cmd.HasAlias("images"))
assert.True(t, cmd.HasAlias("list"))
assert.False(t, cmd.HasAlias("other"))

View File

@ -43,7 +43,7 @@ func TestNewLoadCommandErrors(t *testing.T) {
},
}
for _, tc := range testCases {
cli := test.NewFakeCli(&fakeClient{imageLoadFunc: tc.imageLoadFunc}, new(bytes.Buffer))
cli := test.NewFakeCli(&fakeClient{imageLoadFunc: tc.imageLoadFunc})
cli.In().SetIsTerminal(tc.isTerminalIn)
cmd := NewLoadCommand(cli)
cmd.SetOutput(ioutil.Discard)
@ -54,7 +54,7 @@ func TestNewLoadCommandErrors(t *testing.T) {
func TestNewLoadCommandInvalidInput(t *testing.T) {
expectedError := "open *"
cmd := NewLoadCommand(test.NewFakeCli(&fakeClient{}, new(bytes.Buffer)))
cmd := NewLoadCommand(test.NewFakeCli(&fakeClient{}))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs([]string{"--input", "*"})
err := cmd.Execute()
@ -93,7 +93,7 @@ func TestNewLoadCommandSuccess(t *testing.T) {
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewLoadCommand(test.NewFakeCli(&fakeClient{imageLoadFunc: tc.imageLoadFunc}, buf))
cmd := NewLoadCommand(test.NewFakeCliWithOutput(&fakeClient{imageLoadFunc: tc.imageLoadFunc}, buf))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
err := cmd.Execute()

View File

@ -38,7 +38,7 @@ func TestNewPruneCommandErrors(t *testing.T) {
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewPruneCommand(test.NewFakeCli(&fakeClient{
cmd := NewPruneCommand(test.NewFakeCliWithOutput(&fakeClient{
imagesPruneFunc: tc.imagesPruneFunc,
}, buf))
cmd.SetOutput(ioutil.Discard)
@ -86,7 +86,7 @@ func TestNewPruneCommandSuccess(t *testing.T) {
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewPruneCommand(test.NewFakeCli(&fakeClient{
cmd := NewPruneCommand(test.NewFakeCliWithOutput(&fakeClient{
imagesPruneFunc: tc.imagesPruneFunc,
}, buf))
cmd.SetOutput(ioutil.Discard)

View File

@ -1,29 +1,21 @@
package image
import (
"bytes"
"fmt"
"io/ioutil"
"testing"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/testutil"
"github.com/docker/docker/pkg/testutil/golden"
"github.com/docker/docker/registry"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
)
func TestNewPullCommandErrors(t *testing.T) {
testCases := []struct {
name string
args []string
expectedError string
trustedPullFunc func(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named,
authConfig types.AuthConfig, requestPrivilege types.RequestPrivilegeFunc) error
name string
args []string
expectedError string
}{
{
name: "wrong-args",
@ -47,8 +39,8 @@ func TestNewPullCommandErrors(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewPullCommand(test.NewFakeCli(&fakeClient{}, buf))
cli := test.NewFakeCli(&fakeClient{})
cmd := NewPullCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
@ -57,10 +49,8 @@ func TestNewPullCommandErrors(t *testing.T) {
func TestNewPullCommandSuccess(t *testing.T) {
testCases := []struct {
name string
args []string
trustedPullFunc func(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo, ref reference.Named,
authConfig types.AuthConfig, requestPrivilege types.RequestPrivilegeFunc) error
name string
args []string
}{
{
name: "simple",
@ -72,13 +62,13 @@ func TestNewPullCommandSuccess(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewPullCommand(test.NewFakeCli(&fakeClient{}, buf))
cli := test.NewFakeCli(&fakeClient{})
cmd := NewPullCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
err := cmd.Execute()
assert.NoError(t, err)
actual := buf.String()
actual := cli.OutBuffer().String()
expected := string(golden.Get(t, []byte(actual), fmt.Sprintf("pull-command-success.%s.golden", tc.name))[:])
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, expected)
}

View File

@ -1,21 +1,16 @@
package image
import (
"bytes"
"io"
"io/ioutil"
"strings"
"testing"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/distribution/reference"
"github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/testutil"
"github.com/docker/docker/registry"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
)
func TestNewPushCommandErrors(t *testing.T) {
@ -50,8 +45,8 @@ func TestNewPushCommandErrors(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewPushCommand(test.NewFakeCli(&fakeClient{imagePushFunc: tc.imagePushFunc}, buf))
cli := test.NewFakeCli(&fakeClient{imagePushFunc: tc.imagePushFunc})
cmd := NewPushCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
@ -60,11 +55,8 @@ func TestNewPushCommandErrors(t *testing.T) {
func TestNewPushCommandSuccess(t *testing.T) {
testCases := []struct {
name string
args []string
trustedPushFunc func(ctx context.Context, cli command.Cli, repoInfo *registry.RepositoryInfo,
ref reference.Named, authConfig types.AuthConfig,
requestPrivilege types.RequestPrivilegeFunc) error
name string
args []string
}{
{
name: "simple",
@ -72,12 +64,12 @@ func TestNewPushCommandSuccess(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewPushCommand(test.NewFakeCli(&fakeClient{
cli := test.NewFakeCli(&fakeClient{
imagePushFunc: func(ref string, options types.ImagePushOptions) (io.ReadCloser, error) {
return ioutil.NopCloser(strings.NewReader("")), nil
},
}, buf))
})
cmd := NewPushCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
assert.NoError(t, cmd.Execute())

View File

@ -56,8 +56,8 @@ func runRemove(dockerCli command.Cli, opts removeOptions, images []string) error
}
var errs []string
for _, image := range images {
dels, err := client.ImageRemove(ctx, image, options)
for _, img := range images {
dels, err := client.ImageRemove(ctx, img, options)
if err != nil {
errs = append(errs, err.Error())
} else {
@ -72,7 +72,11 @@ func runRemove(dockerCli command.Cli, opts removeOptions, images []string) error
}
if len(errs) > 0 {
return errors.Errorf("%s", strings.Join(errs, "\n"))
msg := strings.Join(errs, "\n")
if !opts.force {
return errors.New(msg)
}
fmt.Fprintf(dockerCli.Err(), msg)
}
return nil
}

View File

@ -1,7 +1,6 @@
package image
import (
"bytes"
"fmt"
"io/ioutil"
"testing"
@ -15,7 +14,7 @@ import (
)
func TestNewRemoveCommandAlias(t *testing.T) {
cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{}, new(bytes.Buffer)))
cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{}))
assert.True(t, cmd.HasAlias("rmi"))
assert.True(t, cmd.HasAlias("remove"))
assert.False(t, cmd.HasAlias("other"))
@ -46,7 +45,7 @@ func TestNewRemoveCommandErrors(t *testing.T) {
for _, tc := range testCases {
cmd := NewRemoveCommand(test.NewFakeCli(&fakeClient{
imageRemoveFunc: tc.imageRemoveFunc,
}, new(bytes.Buffer)))
}))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
@ -58,6 +57,7 @@ func TestNewRemoveCommandSuccess(t *testing.T) {
name string
args []string
imageRemoveFunc func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
expectedErrMsg string
}{
{
name: "Image Deleted",
@ -67,6 +67,15 @@ func TestNewRemoveCommandSuccess(t *testing.T) {
return []types.ImageDeleteResponseItem{{Deleted: image}}, nil
},
},
{
name: "Image Deleted with force option",
args: []string{"-f", "image1"},
imageRemoveFunc: func(image string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error) {
assert.Equal(t, "image1", image)
return []types.ImageDeleteResponseItem{}, errors.Errorf("error removing image")
},
expectedErrMsg: "error removing image",
},
{
name: "Image Untagged",
args: []string{"image1"},
@ -87,16 +96,15 @@ func TestNewRemoveCommandSuccess(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := NewRemoveCommand(test.NewFakeCli(&fakeClient{
imageRemoveFunc: tc.imageRemoveFunc,
}, buf))
fakeCli := test.NewFakeCli(&fakeClient{imageRemoveFunc: tc.imageRemoveFunc})
cmd := NewRemoveCommand(fakeCli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
assert.NoError(t, cmd.Execute())
err := cmd.Execute()
assert.NoError(t, err)
actual := buf.String()
if tc.expectedErrMsg != "" {
assert.Equal(t, tc.expectedErrMsg, fakeCli.ErrBuffer().String())
}
actual := fakeCli.OutBuffer().String()
expected := string(golden.Get(t, []byte(actual), fmt.Sprintf("remove-command-success.%s.golden", tc.name))[:])
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, expected)
}

View File

@ -45,7 +45,7 @@ func TestNewSaveCommandErrors(t *testing.T) {
},
}
for _, tc := range testCases {
cli := test.NewFakeCli(&fakeClient{imageSaveFunc: tc.imageSaveFunc}, new(bytes.Buffer))
cli := test.NewFakeCli(&fakeClient{imageSaveFunc: tc.imageSaveFunc})
cli.Out().SetIsTerminal(tc.isTerminal)
cmd := NewSaveCommand(cli)
cmd.SetOutput(ioutil.Discard)
@ -85,7 +85,7 @@ func TestNewSaveCommandSuccess(t *testing.T) {
},
}
for _, tc := range testCases {
cmd := NewSaveCommand(test.NewFakeCli(&fakeClient{
cmd := NewSaveCommand(test.NewFakeCliWithOutput(&fakeClient{
imageSaveFunc: func(images []string) (io.ReadCloser, error) {
return ioutil.NopCloser(strings.NewReader("")), nil
},

View File

@ -1,7 +1,6 @@
package image
import (
"bytes"
"io/ioutil"
"testing"
@ -17,9 +16,8 @@ func TestCliNewTagCommandErrors(t *testing.T) {
{"image1", "image2", "image3"},
}
expectedError := "\"tag\" requires exactly 2 argument(s)."
buf := new(bytes.Buffer)
for _, args := range testCases {
cmd := NewTagCommand(test.NewFakeCli(&fakeClient{}, buf))
cmd := NewTagCommand(test.NewFakeCli(&fakeClient{}))
cmd.SetArgs(args)
cmd.SetOutput(ioutil.Discard)
testutil.ErrorContains(t, cmd.Execute(), expectedError)
@ -27,7 +25,6 @@ func TestCliNewTagCommandErrors(t *testing.T) {
}
func TestCliNewTagCommand(t *testing.T) {
buf := new(bytes.Buffer)
cmd := NewTagCommand(
test.NewFakeCli(&fakeClient{
imageTagFunc: func(image string, ref string) error {
@ -35,7 +32,7 @@ func TestCliNewTagCommand(t *testing.T) {
assert.Equal(t, "image2", ref)
return nil
},
}, buf))
}))
cmd.SetArgs([]string{"image1", "image2"})
cmd.SetOutput(ioutil.Discard)
assert.NoError(t, cmd.Execute())

View File

@ -21,6 +21,9 @@
},
"RootFS": {
"Type": ""
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
},
{
@ -45,6 +48,9 @@
},
"RootFS": {
"Type": ""
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]

View File

@ -21,6 +21,9 @@
},
"RootFS": {
"Type": ""
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]

View File

@ -1,4 +1,2 @@
Untagged: image1
Deleted: image2
Untagged: image1
Deleted: image2

View File

@ -1,2 +1 @@
Deleted: image1
Deleted: image1

View File

@ -1,2 +1 @@
Untagged: image1
Untagged: image1

View File

@ -110,6 +110,7 @@ func (i *TemplateInspector) tryRawInspectFallback(rawElement []byte) error {
buffer := new(bytes.Buffer)
rdr := bytes.NewReader(rawElement)
dec := json.NewDecoder(rdr)
dec.UseNumber()
if rawErr := dec.Decode(&raw); rawErr != nil {
return errors.Errorf("unable to read inspect data: %v", rawErr)

View File

@ -6,6 +6,8 @@ import (
"testing"
"github.com/docker/docker/pkg/templates"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
type testElement struct {
@ -219,3 +221,39 @@ func TestIndentedInspectorRawElements(t *testing.T) {
t.Fatalf("Expected `%s`, got `%s`", expected, b.String())
}
}
// moby/moby#32235
// This test verifies that even if `tryRawInspectFallback` is called the fields containing
// numerical values are displayed correctly.
// For example, `docker inspect --format "{{.Id}} {{.Size}} alpine` and
// `docker inspect --format "{{.ID}} {{.Size}} alpine" will have the same output which is
// sha256:651aa95985aa4a17a38ffcf71f598ec461924ca96865facc2c5782ef2d2be07f 3983636
func TestTemplateInspectorRawFallbackNumber(t *testing.T) {
// Using typedElem to automatically fall to tryRawInspectFallback.
typedElem := struct {
ID string `json:"Id"`
}{"ad3"}
testcases := []struct {
raw []byte
exp string
}{
{raw: []byte(`{"Id": "ad3", "Size": 53317}`), exp: "53317 ad3\n"},
{raw: []byte(`{"Id": "ad3", "Size": 53317.102}`), exp: "53317.102 ad3\n"},
{raw: []byte(`{"Id": "ad3", "Size": 53317.0}`), exp: "53317.0 ad3\n"},
}
b := new(bytes.Buffer)
tmpl, err := templates.Parse("{{.Size}} {{.Id}}")
require.NoError(t, err)
i := NewTemplateInspector(b, tmpl)
for _, tc := range testcases {
err = i.Inspect(typedElem, tc.raw)
require.NoError(t, err)
err = i.Flush()
require.NoError(t, err)
assert.Equal(t, tc.exp, b.String())
b.Reset()
}
}

View File

@ -0,0 +1,19 @@
package network
import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"golang.org/x/net/context"
)
type fakeClient struct {
client.Client
networkCreateFunc func(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
}
func (c *fakeClient) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error) {
if c.networkCreateFunc != nil {
return c.networkCreateFunc(ctx, name, options)
}
return types.NetworkCreateResponse{}, nil
}

View File

@ -8,8 +8,7 @@ import (
)
// NewNetworkCommand returns a cobra command for `network` subcommands
// nolint: interfacer
func NewNetworkCommand(dockerCli *command.DockerCli) *cobra.Command {
func NewNetworkCommand(dockerCli command.Cli) *cobra.Command {
cmd := &cobra.Command{
Use: "network",
Short: "Manage networks",

View File

@ -19,7 +19,7 @@ type connectOptions struct {
linklocalips []string
}
func newConnectCommand(dockerCli *command.DockerCli) *cobra.Command {
func newConnectCommand(dockerCli command.Cli) *cobra.Command {
options := connectOptions{
links: opts.NewListOpts(opts.ValidateLink),
}
@ -45,7 +45,7 @@ func newConnectCommand(dockerCli *command.DockerCli) *cobra.Command {
return cmd
}
func runConnect(dockerCli *command.DockerCli, options connectOptions) error {
func runConnect(dockerCli command.Cli, options connectOptions) error {
client := dockerCli.Client()
epConfig := &network.EndpointSettings{

View File

@ -10,7 +10,6 @@ import (
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
runconfigopts "github.com/docker/docker/runconfig/opts"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/net/context"
@ -37,7 +36,7 @@ type createOptions struct {
ipamOpt opts.MapOpts
}
func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
func newCreateCommand(dockerCli command.Cli) *cobra.Command {
options := createOptions{
driverOpts: *opts.NewMapOpts(nil, nil),
labels: opts.NewListOpts(opts.ValidateEnv),
@ -83,7 +82,7 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
return cmd
}
func runCreate(dockerCli *command.DockerCli, options createOptions) error {
func runCreate(dockerCli command.Cli, options createOptions) error {
client := dockerCli.Client()
ipamCfg, err := consolidateIpam(options.ipamSubnet, options.ipamIPRange, options.ipamGateway, options.ipamAux.GetAll())
@ -107,7 +106,7 @@ func runCreate(dockerCli *command.DockerCli, options createOptions) error {
Ingress: options.ingress,
Scope: options.scope,
ConfigOnly: options.configOnly,
Labels: runconfigopts.ConvertKVStringsToMap(options.labels.GetAll()),
Labels: opts.ConvertKVStringsToMap(options.labels.GetAll()),
}
if from := options.configFrom; from != "" {
@ -233,13 +232,13 @@ func subnetMatches(subnet, data string) (bool, error) {
_, s, err := net.ParseCIDR(subnet)
if err != nil {
return false, errors.Errorf("Invalid subnet %s : %v", s, err)
return false, errors.Wrap(err, "invalid subnet")
}
if strings.Contains(data, "/") {
ip, _, err = net.ParseCIDR(data)
if err != nil {
return false, errors.Errorf("Invalid cidr %s : %v", data, err)
return false, err
}
} else {
ip = net.ParseIP(data)

View File

@ -0,0 +1,175 @@
package network
import (
"io/ioutil"
"strings"
"testing"
"github.com/docker/cli/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/pkg/testutil"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
)
func TestNetworkCreateErrors(t *testing.T) {
testCases := []struct {
args []string
flags map[string]string
networkCreateFunc func(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
expectedError string
}{
{
expectedError: "exactly 1 argument",
},
{
args: []string{"toto"},
networkCreateFunc: func(ctx context.Context, name string, createBody types.NetworkCreate) (types.NetworkCreateResponse, error) {
return types.NetworkCreateResponse{}, errors.Errorf("error creating network")
},
expectedError: "error creating network",
},
{
args: []string{"toto"},
flags: map[string]string{
"ip-range": "255.255.0.0/24",
"gateway": "255.0.255.0/24",
"subnet": "10.1.2.0.30.50",
},
expectedError: "invalid CIDR address: 10.1.2.0.30.50",
},
{
args: []string{"toto"},
flags: map[string]string{
"ip-range": "255.255.0.0.30/24",
"gateway": "255.0.255.0/24",
"subnet": "255.0.0.0/24",
},
expectedError: "invalid CIDR address: 255.255.0.0.30/24",
},
{
args: []string{"toto"},
flags: map[string]string{
"gateway": "255.0.0.0/24",
},
expectedError: "every ip-range or gateway must have a corresponding subnet",
},
{
args: []string{"toto"},
flags: map[string]string{
"ip-range": "255.0.0.0/24",
},
expectedError: "every ip-range or gateway must have a corresponding subnet",
},
{
args: []string{"toto"},
flags: map[string]string{
"ip-range": "255.0.0.0/24",
"gateway": "255.0.0.0/24",
},
expectedError: "every ip-range or gateway must have a corresponding subnet",
},
{
args: []string{"toto"},
flags: map[string]string{
"ip-range": "255.255.0.0/24",
"gateway": "255.0.255.0/24",
"subnet": "10.1.2.0/23,10.1.3.248/30",
},
expectedError: "multiple overlapping subnet configuration is not supported",
},
{
args: []string{"toto"},
flags: map[string]string{
"ip-range": "192.168.1.0/24,192.168.1.200/24",
"gateway": "192.168.1.1,192.168.1.4",
"subnet": "192.168.2.0/24,192.168.1.250/24",
},
expectedError: "cannot configure multiple ranges (192.168.1.200/24, 192.168.1.0/24) on the same subnet (192.168.1.250/24)",
},
{
args: []string{"toto"},
flags: map[string]string{
"ip-range": "255.255.200.0/24,255.255.120.0/24",
"gateway": "255.0.255.0/24",
"subnet": "255.255.255.0/24,255.255.0.255/24",
},
expectedError: "no matching subnet for range 255.255.200.0/24",
},
{
args: []string{"toto"},
flags: map[string]string{
"ip-range": "192.168.1.0/24",
"gateway": "192.168.1.1,192.168.1.4",
"subnet": "192.168.2.0/24,192.168.1.250/24",
},
expectedError: "cannot configure multiple gateways (192.168.1.4, 192.168.1.1) for the same subnet (192.168.1.250/24)",
},
{
args: []string{"toto"},
flags: map[string]string{
"ip-range": "192.168.1.0/24",
"gateway": "192.168.4.1,192.168.5.4",
"subnet": "192.168.2.0/24,192.168.1.250/24",
},
expectedError: "no matching subnet for gateway 192.168.4.1",
},
{
args: []string{"toto"},
flags: map[string]string{
"gateway": "255.255.0.0/24",
"subnet": "255.255.0.0/24",
"aux-address": "255.255.0.30/24",
},
expectedError: "no matching subnet for aux-address",
},
}
for _, tc := range testCases {
cmd := newCreateCommand(
test.NewFakeCli(&fakeClient{
networkCreateFunc: tc.networkCreateFunc,
}),
)
cmd.SetArgs(tc.args)
for key, value := range tc.flags {
require.NoError(t, cmd.Flags().Set(key, value))
}
cmd.SetOutput(ioutil.Discard)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
}
}
func TestNetworkCreateWithFlags(t *testing.T) {
expectedDriver := "foo"
expectedOpts := []network.IPAMConfig{
{
"192.168.4.0/24",
"192.168.4.0/24",
"192.168.4.1/24",
map[string]string{},
},
}
cli := test.NewFakeCli(&fakeClient{
networkCreateFunc: func(ctx context.Context, name string, createBody types.NetworkCreate) (types.NetworkCreateResponse, error) {
assert.Equal(t, expectedDriver, createBody.Driver, "not expected driver error")
assert.Equal(t, expectedOpts, createBody.IPAM.Config, "not expected driver error")
return types.NetworkCreateResponse{
ID: name,
}, nil
},
})
args := []string{"banana"}
cmd := newCreateCommand(cli)
cmd.SetArgs(args)
cmd.Flags().Set("driver", "foo")
cmd.Flags().Set("ip-range", "192.168.4.0/24")
cmd.Flags().Set("gateway", "192.168.4.1/24")
cmd.Flags().Set("subnet", "192.168.4.0/24")
assert.NoError(t, cmd.Execute())
assert.Equal(t, "banana", strings.TrimSpace(cli.OutBuffer().String()))
}

View File

@ -14,7 +14,7 @@ type disconnectOptions struct {
force bool
}
func newDisconnectCommand(dockerCli *command.DockerCli) *cobra.Command {
func newDisconnectCommand(dockerCli command.Cli) *cobra.Command {
opts := disconnectOptions{}
cmd := &cobra.Command{
@ -34,7 +34,7 @@ func newDisconnectCommand(dockerCli *command.DockerCli) *cobra.Command {
return cmd
}
func runDisconnect(dockerCli *command.DockerCli, opts disconnectOptions) error {
func runDisconnect(dockerCli command.Cli, opts disconnectOptions) error {
client := dockerCli.Client()
return client.NetworkDisconnect(context.Background(), opts.network, opts.container, opts.force)

View File

@ -6,6 +6,7 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/inspect"
"github.com/docker/docker/api/types"
"github.com/spf13/cobra"
)
@ -15,7 +16,7 @@ type inspectOptions struct {
verbose bool
}
func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
func newInspectCommand(dockerCli command.Cli) *cobra.Command {
var opts inspectOptions
cmd := &cobra.Command{
@ -34,13 +35,13 @@ func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
return cmd
}
func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error {
func runInspect(dockerCli command.Cli, opts inspectOptions) error {
client := dockerCli.Client()
ctx := context.Background()
getNetFunc := func(name string) (interface{}, []byte, error) {
return client.NetworkInspectWithRaw(ctx, name, opts.verbose)
return client.NetworkInspectWithRaw(ctx, name, types.NetworkInspectOptions{Verbose: opts.verbose})
}
return inspect.Inspect(dockerCli.Out(), opts.names, opts.format, getNetFunc)

View File

@ -25,7 +25,7 @@ type listOptions struct {
filter opts.FilterOpt
}
func newListCommand(dockerCli *command.DockerCli) *cobra.Command {
func newListCommand(dockerCli command.Cli) *cobra.Command {
options := listOptions{filter: opts.NewFilterOpt()}
cmd := &cobra.Command{
@ -47,7 +47,7 @@ func newListCommand(dockerCli *command.DockerCli) *cobra.Command {
return cmd
}
func runList(dockerCli *command.DockerCli, options listOptions) error {
func runList(dockerCli command.Cli, options listOptions) error {
client := dockerCli.Client()
listOptions := types.NetworkListOptions{Filters: options.filter.Value()}
networkResources, err := client.NetworkList(context.Background(), listOptions)

View File

@ -7,10 +7,11 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/docker/api/types"
"github.com/spf13/cobra"
)
func newRemoveCommand(dockerCli *command.DockerCli) *cobra.Command {
func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
return &cobra.Command{
Use: "rm NETWORK [NETWORK...]",
Aliases: []string{"remove"},
@ -27,13 +28,13 @@ const ingressWarning = "WARNING! Before removing the routing-mesh network, " +
"Otherwise, removal may not be effective and functionality of newly create " +
"ingress networks will be impaired.\nAre you sure you want to continue?"
func runRemove(dockerCli *command.DockerCli, networks []string) error {
func runRemove(dockerCli command.Cli, networks []string) error {
client := dockerCli.Client()
ctx := context.Background()
status := 0
for _, name := range networks {
if nw, _, err := client.NetworkInspectWithRaw(ctx, name, false); err == nil &&
if nw, _, err := client.NetworkInspectWithRaw(ctx, name, types.NetworkInspectOptions{}); err == nil &&
nw.Ingress &&
!command.PromptForConfirmation(dockerCli.In(), dockerCli.Out(), ingressWarning) {
continue

View File

@ -1,7 +1,6 @@
package node
import (
"bytes"
"io/ioutil"
"testing"
@ -40,12 +39,11 @@ func TestNodeDemoteErrors(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newDemoteCommand(
test.NewFakeCli(&fakeClient{
nodeInspectFunc: tc.nodeInspectFunc,
nodeUpdateFunc: tc.nodeUpdateFunc,
}, buf))
}))
cmd.SetArgs(tc.args)
cmd.SetOutput(ioutil.Discard)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
@ -53,7 +51,6 @@ func TestNodeDemoteErrors(t *testing.T) {
}
func TestNodeDemoteNoChange(t *testing.T) {
buf := new(bytes.Buffer)
cmd := newDemoteCommand(
test.NewFakeCli(&fakeClient{
nodeInspectFunc: func() (swarm.Node, []byte, error) {
@ -65,13 +62,12 @@ func TestNodeDemoteNoChange(t *testing.T) {
}
return nil
},
}, buf))
}))
cmd.SetArgs([]string{"nodeID"})
assert.NoError(t, cmd.Execute())
}
func TestNodeDemoteMultipleNode(t *testing.T) {
buf := new(bytes.Buffer)
cmd := newDemoteCommand(
test.NewFakeCli(&fakeClient{
nodeInspectFunc: func() (swarm.Node, []byte, error) {
@ -83,7 +79,7 @@ func TestNodeDemoteMultipleNode(t *testing.T) {
}
return nil
},
}, buf))
}))
cmd.SetArgs([]string{"nodeID1", "nodeID2"})
assert.NoError(t, cmd.Execute())
}

View File

@ -69,7 +69,7 @@ func TestNodeInspectErrors(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newInspectCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
nodeInspectFunc: tc.nodeInspectFunc,
infoFunc: tc.infoFunc,
}, buf))
@ -111,7 +111,7 @@ func TestNodeInspectPretty(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newInspectCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
nodeInspectFunc: tc.nodeInspectFunc,
}, buf))
cmd.SetArgs([]string{"nodeID"})

View File

@ -1,15 +1,27 @@
package node
import (
"sort"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/spf13/cobra"
"golang.org/x/net/context"
"vbom.ml/util/sortorder"
)
type byHostname []swarm.Node
func (n byHostname) Len() int { return len(n) }
func (n byHostname) Swap(i, j int) { n[i], n[j] = n[j], n[i] }
func (n byHostname) Less(i, j int) bool {
return sortorder.NaturalLess(n[i].Description.Hostname, n[j].Description.Hostname)
}
type listOptions struct {
quiet bool
format string
@ -68,5 +80,6 @@ func runList(dockerCli command.Cli, options listOptions) error {
Output: dockerCli.Out(),
Format: formatter.NewNodeFormat(format, options.quiet),
}
sort.Sort(byHostname(nodes))
return formatter.NodeWrite(nodesCtx, nodes, info)
}

View File

@ -9,6 +9,8 @@ import (
"github.com/docker/cli/cli/internal/test"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/pkg/testutil"
"github.com/docker/docker/pkg/testutil/golden"
"github.com/pkg/errors"
// Import builders to get the builder function as package function
. "github.com/docker/cli/cli/internal/test/builders"
@ -42,12 +44,10 @@ func TestNodeListErrorOnAPIFailure(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
nodeListFunc: tc.nodeListFunc,
infoFunc: tc.infoFunc,
}, buf)
cli.SetConfigfile(&configfile.ConfigFile{})
})
cmd := newListCommand(cli)
cmd.SetOutput(ioutil.Discard)
assert.EqualError(t, cmd.Execute(), tc.expectedError)
@ -55,7 +55,6 @@ func TestNodeListErrorOnAPIFailure(t *testing.T) {
}
func TestNodeList(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
nodeListFunc: func() ([]swarm.Node, error) {
return []swarm.Node{
@ -71,25 +70,25 @@ func TestNodeList(t *testing.T) {
},
}, nil
},
}, buf)
cli.SetConfigfile(&configfile.ConfigFile{})
})
cmd := newListCommand(cli)
assert.NoError(t, cmd.Execute())
assert.Contains(t, buf.String(), `nodeID1 * nodeHostname1 Ready Active Leader`)
assert.Contains(t, buf.String(), `nodeID2 nodeHostname2 Ready Active Reachable`)
assert.Contains(t, buf.String(), `nodeID3 nodeHostname3 Ready Active`)
out := cli.OutBuffer().String()
assert.Contains(t, out, `nodeID1 * nodeHostname1 Ready Active Leader`)
assert.Contains(t, out, `nodeID2 nodeHostname2 Ready Active Reachable`)
assert.Contains(t, out, `nodeID3 nodeHostname3 Ready Active`)
}
func TestNodeListQuietShouldOnlyPrintIDs(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
cli := test.NewFakeCliWithOutput(&fakeClient{
nodeListFunc: func() ([]swarm.Node, error) {
return []swarm.Node{
*Node(),
}, nil
},
}, buf)
cli.SetConfigfile(&configfile.ConfigFile{})
cmd := newListCommand(cli)
cmd.Flags().Set("quiet", "true")
assert.NoError(t, cmd.Execute())
@ -99,8 +98,7 @@ func TestNodeListQuietShouldOnlyPrintIDs(t *testing.T) {
// Test case for #24090
func TestNodeListContainsHostname(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{}, buf)
cli.SetConfigfile(&configfile.ConfigFile{})
cli := test.NewFakeCliWithOutput(&fakeClient{}, buf)
cmd := newListCommand(cli)
assert.NoError(t, cmd.Execute())
assert.Contains(t, buf.String(), "HOSTNAME")
@ -108,7 +106,7 @@ func TestNodeListContainsHostname(t *testing.T) {
func TestNodeListDefaultFormat(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
cli := test.NewFakeCliWithOutput(&fakeClient{
nodeListFunc: func() ([]swarm.Node, error) {
return []swarm.Node{
*Node(NodeID("nodeID1"), Hostname("nodeHostname1"), Manager(Leader())),
@ -124,7 +122,7 @@ func TestNodeListDefaultFormat(t *testing.T) {
}, nil
},
}, buf)
cli.SetConfigfile(&configfile.ConfigFile{
cli.SetConfigFile(&configfile.ConfigFile{
NodesFormat: "{{.ID}}: {{.Hostname}} {{.Status}}/{{.ManagerStatus}}",
})
cmd := newListCommand(cli)
@ -136,7 +134,7 @@ func TestNodeListDefaultFormat(t *testing.T) {
func TestNodeListFormat(t *testing.T) {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{
cli := test.NewFakeCliWithOutput(&fakeClient{
nodeListFunc: func() ([]swarm.Node, error) {
return []swarm.Node{
*Node(NodeID("nodeID1"), Hostname("nodeHostname1"), Manager(Leader())),
@ -151,7 +149,7 @@ func TestNodeListFormat(t *testing.T) {
}, nil
},
}, buf)
cli.SetConfigfile(&configfile.ConfigFile{
cli.SetConfigFile(&configfile.ConfigFile{
NodesFormat: "{{.ID}}: {{.Hostname}} {{.Status}}/{{.ManagerStatus}}",
})
cmd := newListCommand(cli)
@ -160,3 +158,22 @@ func TestNodeListFormat(t *testing.T) {
assert.Contains(t, buf.String(), `nodeHostname1: Leader`)
assert.Contains(t, buf.String(), `nodeHostname2: Reachable`)
}
func TestNodeListOrder(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{
nodeListFunc: func() ([]swarm.Node, error) {
return []swarm.Node{
*Node(Hostname("node-2-foo"), Manager(Leader())),
*Node(Hostname("node-10-foo"), Manager()),
*Node(Hostname("node-1-foo")),
}, nil
},
})
cmd := newListCommand(cli)
cmd.Flags().Set("format", "{{.Hostname}}: {{.ManagerStatus}}")
assert.NoError(t, cmd.Execute())
actual := cli.OutBuffer().String()
expected := golden.Get(t, []byte(actual), "node-list-sort.golden")
testutil.EqualNormalizedString(t, testutil.RemoveSpace, actual, string(expected))
}

View File

@ -11,7 +11,6 @@ type nodeOptions struct {
}
type annotations struct {
name string
labels opts.ListOpts
}

View File

@ -42,7 +42,7 @@ func TestNodePromoteErrors(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newPromoteCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
nodeInspectFunc: tc.nodeInspectFunc,
nodeUpdateFunc: tc.nodeUpdateFunc,
}, buf))
@ -55,7 +55,7 @@ func TestNodePromoteErrors(t *testing.T) {
func TestNodePromoteNoChange(t *testing.T) {
buf := new(bytes.Buffer)
cmd := newPromoteCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
nodeInspectFunc: func() (swarm.Node, []byte, error) {
return *Node(Manager()), []byte{}, nil
},
@ -73,7 +73,7 @@ func TestNodePromoteNoChange(t *testing.T) {
func TestNodePromoteMultipleNode(t *testing.T) {
buf := new(bytes.Buffer)
cmd := newPromoteCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
nodeInspectFunc: func() (swarm.Node, []byte, error) {
return *Node(), []byte{}, nil
},

View File

@ -5,7 +5,6 @@ import (
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/formatter"
"github.com/docker/cli/cli/command/idresolver"
"github.com/docker/cli/cli/command/task"
"github.com/docker/cli/opts"
@ -88,11 +87,7 @@ func runPs(dockerCli command.Cli, options psOptions) error {
format := options.format
if len(format) == 0 {
if dockerCli.ConfigFile() != nil && len(dockerCli.ConfigFile().TasksFormat) > 0 && !options.quiet {
format = dockerCli.ConfigFile().TasksFormat
} else {
format = formatter.TableFormatKey
}
format = task.DefaultFormat(dockerCli.ConfigFile(), options.quiet)
}
if len(errs) == 0 || len(tasks) != 0 {

View File

@ -52,7 +52,7 @@ func TestNodePsErrors(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newPsCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
infoFunc: tc.infoFunc,
nodeInspectFunc: tc.nodeInspectFunc,
taskInspectFunc: tc.taskInspectFunc,
@ -116,7 +116,7 @@ func TestNodePs(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newPsCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
infoFunc: tc.infoFunc,
nodeInspectFunc: tc.nodeInspectFunc,
taskInspectFunc: tc.taskInspectFunc,

View File

@ -31,7 +31,7 @@ func TestNodeRemoveErrors(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newRemoveCommand(
test.NewFakeCli(&fakeClient{
test.NewFakeCliWithOutput(&fakeClient{
nodeRemoveFunc: tc.nodeRemoveFunc,
}, buf))
cmd.SetArgs(tc.args)
@ -42,7 +42,7 @@ func TestNodeRemoveErrors(t *testing.T) {
func TestNodeRemoveMultiple(t *testing.T) {
buf := new(bytes.Buffer)
cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{}, buf))
cmd := newRemoveCommand(test.NewFakeCliWithOutput(&fakeClient{}, buf))
cmd.SetArgs([]string{"nodeID1", "nodeID2"})
assert.NoError(t, cmd.Execute())
}

View File

@ -0,0 +1,3 @@
node-1-foo:
node-2-foo: Leader
node-10-foo: Reachable

View File

@ -7,7 +7,6 @@ import (
"github.com/docker/cli/cli/command"
"github.com/docker/cli/opts"
"github.com/docker/docker/api/types/swarm"
runconfigopts "github.com/docker/docker/runconfig/opts"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@ -95,7 +94,7 @@ func mergeNodeUpdate(flags *pflag.FlagSet) func(*swarm.Node) error {
}
if flags.Changed(flagLabelAdd) {
labels := flags.Lookup(flagLabelAdd).Value.(*opts.ListOpts).GetAll()
for k, v := range runconfigopts.ConvertKVStringsToMap(labels) {
for k, v := range opts.ConvertKVStringsToMap(labels) {
spec.Annotations.Labels[k] = v
}
}

View File

@ -1,7 +1,6 @@
package node
import (
"bytes"
"io/ioutil"
"testing"
@ -57,12 +56,11 @@ func TestNodeUpdateErrors(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newUpdateCommand(
test.NewFakeCli(&fakeClient{
nodeInspectFunc: tc.nodeInspectFunc,
nodeUpdateFunc: tc.nodeUpdateFunc,
}, buf))
}))
cmd.SetArgs(tc.args)
for key, value := range tc.flags {
cmd.Flags().Set(key, value)
@ -158,12 +156,11 @@ func TestNodeUpdate(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newUpdateCommand(
test.NewFakeCli(&fakeClient{
nodeInspectFunc: tc.nodeInspectFunc,
nodeUpdateFunc: tc.nodeUpdateFunc,
}, buf))
}))
cmd.SetArgs(tc.args)
for key, value := range tc.flags {
cmd.Flags().Set(key, value)

View File

@ -1,51 +0,0 @@
package prune
import (
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/command/container"
"github.com/docker/cli/cli/command/image"
"github.com/docker/cli/cli/command/network"
"github.com/docker/cli/cli/command/volume"
"github.com/docker/cli/opts"
"github.com/spf13/cobra"
)
// NewContainerPruneCommand returns a cobra prune command for containers
func NewContainerPruneCommand(dockerCli command.Cli) *cobra.Command {
return container.NewPruneCommand(dockerCli)
}
// NewVolumePruneCommand returns a cobra prune command for volumes
func NewVolumePruneCommand(dockerCli command.Cli) *cobra.Command {
return volume.NewPruneCommand(dockerCli)
}
// NewImagePruneCommand returns a cobra prune command for images
func NewImagePruneCommand(dockerCli command.Cli) *cobra.Command {
return image.NewPruneCommand(dockerCli)
}
// NewNetworkPruneCommand returns a cobra prune command for Networks
func NewNetworkPruneCommand(dockerCli command.Cli) *cobra.Command {
return network.NewPruneCommand(dockerCli)
}
// RunContainerPrune executes a prune command for containers
func RunContainerPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return container.RunPrune(dockerCli, filter)
}
// RunVolumePrune executes a prune command for volumes
func RunVolumePrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return volume.RunPrune(dockerCli, filter)
}
// RunImagePrune executes a prune command for images
func RunImagePrune(dockerCli command.Cli, all bool, filter opts.FilterOpt) (uint64, string, error) {
return image.RunPrune(dockerCli, all, filter)
}
// RunNetworkPrune executes a prune command for networks
func RunNetworkPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) {
return network.RunPrune(dockerCli, filter)
}

View File

@ -70,7 +70,7 @@ func ResolveAuthConfig(ctx context.Context, cli Cli, index *registrytypes.IndexI
configKey = ElectAuthServer(ctx, cli)
}
a, _ := cli.CredentialsStore(configKey).Get(configKey)
a, _ := cli.ConfigFile().GetAuthConfig(configKey)
return a
}
@ -85,7 +85,7 @@ func ConfigureAuth(cli Cli, flUser, flPassword, serverAddress string, isDefaultR
serverAddress = registry.ConvertToHostname(serverAddress)
}
authconfig, err := cli.CredentialsStore(serverAddress).Get(serverAddress)
authconfig, err := cli.ConfigFile().GetAuthConfig(serverAddress)
if err != nil {
return authconfig, err
}

View File

@ -2,6 +2,8 @@ package registry
import (
"fmt"
"io/ioutil"
"strings"
"golang.org/x/net/context"
@ -16,7 +18,7 @@ type loginOptions struct {
serverAddress string
user string
password string
email string
passwordStdin bool
}
// NewLoginCommand creates a new `docker login` command
@ -40,6 +42,7 @@ func NewLoginCommand(dockerCli command.Cli) *cobra.Command {
flags.StringVarP(&opts.user, "username", "u", "", "Username")
flags.StringVarP(&opts.password, "password", "p", "", "Password")
flags.BoolVarP(&opts.passwordStdin, "password-stdin", "", false, "Take the password from stdin")
return cmd
}
@ -48,6 +51,27 @@ func runLogin(dockerCli command.Cli, opts loginOptions) error {
ctx := context.Background()
clnt := dockerCli.Client()
if opts.password != "" {
fmt.Fprintln(dockerCli.Err(), "WARNING! Using --password via the CLI is insecure. Use --password-stdin.")
if opts.passwordStdin {
return errors.New("--password and --password-stdin are mutually exclusive")
}
}
if opts.passwordStdin {
if opts.user == "" {
return errors.New("Must provide --username with --password-stdin")
}
contents, err := ioutil.ReadAll(dockerCli.In())
if err != nil {
return err
}
opts.password = strings.TrimSuffix(string(contents), "\n")
opts.password = strings.TrimSuffix(opts.password, "\r")
}
var (
serverAddress string
authServer = command.ElectAuthServer(ctx, dockerCli)
@ -72,7 +96,7 @@ func runLogin(dockerCli command.Cli, opts loginOptions) error {
authConfig.Password = ""
authConfig.IdentityToken = response.IdentityToken
}
if err := dockerCli.CredentialsStore(serverAddress).Store(authConfig); err != nil {
if err := dockerCli.ConfigFile().GetCredentialsStore(serverAddress).Store(authConfig); err != nil {
return errors.Errorf("Error saving credentials: %v", err)
}

View File

@ -68,7 +68,7 @@ func runLogout(dockerCli command.Cli, serverAddress string) error {
fmt.Fprintf(dockerCli.Out(), "Removing login credentials for %s\n", hostnameAddress)
for _, r := range regsToLogout {
if err := dockerCli.CredentialsStore(r).Erase(r); err != nil {
if err := dockerCli.ConfigFile().GetCredentialsStore(r).Erase(r); err != nil {
fmt.Fprintf(dockerCli.Err(), "WARNING: could not erase credentials: %v\n", err)
}
}

View File

@ -1,7 +1,6 @@
package command_test
import (
"bytes"
"testing"
"github.com/pkg/errors"
@ -63,13 +62,10 @@ func TestElectAuthServer(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{infoFunc: tc.infoFunc}, buf)
errBuf := new(bytes.Buffer)
cli.SetErr(errBuf)
cli := test.NewFakeCli(&fakeClient{infoFunc: tc.infoFunc})
server := ElectAuthServer(context.Background(), cli)
assert.Equal(t, tc.expectedAuthServer, server)
actual := errBuf.String()
actual := cli.ErrBuffer().String()
if tc.expectedWarning == "" {
assert.Empty(t, actual)
} else {

Some files were not shown because too many files have changed in this diff Show More