Commit Graph

77 Commits

Author SHA1 Message Date
1922dbc3eb Merge pull request #20772 from Microsoft/jjh/testunitdistribution-xfer
Windows CI Unit Test: Distribution\xfer turn off failing tests
Upstream-commit: 8ffec1fca5d851e9f8e33e3dfab5c6ebc9562284
Component: engine
2016-02-29 10:45:57 -05:00
351fe56c91 Merge pull request #20771 from Microsoft/jjh/disableunittestsdistribution
Windows CI Unit Test: Distribution turn off failing tests
Upstream-commit: da4f2ce6294f9333a7b9011f80d7b64815cc2059
Component: engine
2016-02-29 12:56:10 +01:00
cdf59b59f2 Windows CI Unit Test: Distribution\xfer turn off failing tests
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: dd2ff281bf62037948a9da18dd2223b977056a4e
Component: engine
2016-02-28 20:08:34 -08:00
f53e7a1a3f Windows CI Unit Test: Distribution turn off failing tests
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 621a1b9aca7f0ad2ac6b83f990644c3dc983d659
Component: engine
2016-02-28 20:02:51 -08:00
acc7d09962 Improve fallback behavior for cross-repository push
Attempt layer mounts from up to 3 source repositories, possibly
falling back to a standard blob upload for cross repository pushes.
Addresses compatiblity issues with token servers which do not grant
multiple repository scopes, resulting in an authentication failure for
layer mounts, which would otherwise cause the push to terminate with an
error.

Signed-off-by: Brian Bland <brian.bland@docker.com>
Upstream-commit: 1d3480f9ba3525309030497d5c8a3dd5725ed15a
Component: engine
2016-02-24 19:13:35 -08:00
e240ca3d3c Change APIEndpoint to contain the URL in a parsed format
This allows easier URL handling in code that uses APIEndpoint.
If we continued to store the URL unparsed, it would require redundant
parsing whenver we want to extract information from it. Also, parsing
the URL earlier should give improve validation.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 79db131a358f15d4bdef37e251daf27429d116b3
Component: engine
2016-02-17 17:48:15 -08:00
80c4954d96 Smarter push/pull TLS fallback
With the --insecure-registry daemon option (or talking to a registry on
a local IP), the daemon will first try TLS, and then try plaintext if
something goes wrong with the push or pull. It doesn't make sense to try
plaintext if a HTTP request went through while using TLS. This commit
changes the logic to keep track of host/port combinations where a TLS
attempt managed to do at least one HTTP request (whether the response
code indicated success or not). If the host/port responded to a HTTP
using TLS, we won't try to make plaintext HTTP requests to it.

This will result in better error messages, which sometimes ended up
showing the result of the plaintext attempt, like this:

    Error response from daemon: Get
    http://myregistrydomain.com:5000/v2/: malformed HTTP response
    "\x15\x03\x01\x00\x02\x02"

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 5e8af46fda3f4e17e06726237fc6b9ab6957e3ea
Component: engine
2016-02-12 13:47:48 -08:00
043a0cfc7b Merge pull request #20247 from aaronlehmann/distribution-errors
Push/pull errors improvement and cleanup
Upstream-commit: e17afedfe061ce2f02451c213b7c8b7aae01ba2f
Component: engine
2016-02-12 11:57:25 +01:00
992182031d Merge pull request #20250 from vieux/fix_misspell
fix common misspells
Upstream-commit: 5ca6d3bafd0dd53dd26f8251218c68a8016e5ce7
Component: engine
2016-02-11 17:22:06 -08:00
fbf0db8827 Push/pull errors improvement and cleanup
Several improvements to error handling:

- Introduce ImageConfigPullError type, wrapping errors related to
  downloading the image configuration blob in schema2. This allows for a
  more descriptive error message to be seen by the end user.

- Change some logrus.Debugf calls that display errors to logrus.Errorf.
  Add log lines in the push/pull fallback cases to make sure the errors
  leading to the fallback are shown.

- Move error-related types and functions which are only used by the
  distribution package out of the registry package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 8f26fe4f59ce515c68440da1443ace4c96e89d4a
Component: engine
2016-02-11 16:28:56 -08:00
697a990701 fix common misspell
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 99a396902f0ea9d81ef87a683489b2435408f415
Component: engine
2016-02-11 15:49:36 -08:00
bd6d7c6931 Fall back to V1 when there are no basic auth credentials
This makes the behavior consistent with having incorrect credentials.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 7b81bc147cf75cb32697e8fdf88e05ae879cb879
Component: engine
2016-02-11 10:48:11 -08:00
9e9ae7353a Attempt to resume downloads after certain errors
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 056bf9f25ec95a927eb150bef3adea630ce71414
Component: engine
2016-02-09 14:12:28 -08:00
1a12277ae5 Move temporary download file to download descriptor scope
This will allow it to be reused between download attempts in a
subsequent commit.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: f425529e7e0a6b15c8cc43f0c1dbb7a42572e30d
Component: engine
2016-02-09 14:12:28 -08:00
2c1fe5f691 Merge pull request #19887 from aaronlehmann/vendor-resumable-downloads
Vendor updated distribution for resumable downloads
Upstream-commit: 9f0095f14a007950a17b000f268bb29ac5a5fa5c
Component: engine
2016-02-05 12:58:53 -08:00
d323843da1 Vendor updated distribution for resumable downloads
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 4d437a29d28ec2d47ff7cf0868390b921ededa03
Component: engine
2016-02-04 17:33:37 -08:00
e7c326da3c Merge pull request #19702 from tiborvass/host-specific-passthru-token
Add test to make sure the new registry pass-thru token is only sent to the intended hosts
Upstream-commit: 66a4e557f955713adea5c97e42202fdbc0f5c06c
Component: engine
2016-02-03 21:57:32 -05:00
d3428a009e Merge pull request #19971 from aaronlehmann/revert-19743
Revert "Set idle timeouts for HTTP reads and writes in communications with the registry"
Upstream-commit: 3fa0d09e74131f4a4dca43a1a28eb014028be62d
Component: engine
2016-02-03 15:33:29 -05:00
d9ed04ff60 Merge pull request #18680 from aaronlehmann/duplicate-pull-complete-message
Avoid outputting last progress item twice
Upstream-commit: bce70cdc2c4f80e75ca7435e2f3016b904b5c3f2
Component: engine
2016-02-03 11:01:45 -08:00
cc7637793b Revert "Set idle timeouts for HTTP reads and writes in communications with the registry"
This reverts commit 84b2162c1a15256ac09396ad0d75686ea468f40c.

The intent of this commit was to set an idle timeout on a HTTP
connection. If a read took more than 60 seconds to complete, or a write
took more than 60 seconds to complete, the connection would be
considered dead.

This doesn't work properly, because the HTTP internals apparently read
from the connection concurrently while writing. An upload that doesn't
complete in 60 seconds leads to a timeout.

Fixes #19967

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: cbda80aaff026329a13bb2d0943a4c428251e207
Component: engine
2016-02-03 09:59:56 -08:00
45a13ca311 Fix panic on network timeout during push
`Upload` already closes the reader returned by `compress` and the
progressreader passed into it, before returning. But even so, the
io.Copy inside compress' goroutine needs to attempt a read from the
progressreader to notice that it's closed, and this read has a side
effect of outputting a progress message. If this happens after `Upload`
returns, it can result in a write to a closed channel. Change `compress`
to return a channel that allows the caller to wait for its goroutine to
finish before freeing any resources connected to the reader that was
passed to it.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: e273445dd407df6803d7b80863b644a6cfa2c1f5
Component: engine
2016-01-29 14:34:50 -08:00
85dd8b9875 distribution: add test to ensure pass-thru registry token is host-bound
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: f3df50d115c81c13349835a15f5bad0f2c15dfe4
Component: engine
2016-01-28 16:23:06 -08:00
665c7f7ff1 Set idle timeouts for HTTP reads and writes in communications with the registry
Otherwise, some operations can get stuck indefinitely when the remote
side is unresponsive.

Fixes #12823

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 84b2162c1a15256ac09396ad0d75686ea468f40c
Component: engine
2016-01-26 12:40:39 -08:00
dfa69d7101 Avoid outputting last progress item twice
A watcher would output the current progress item when it was detached,
in case it missed that item earlier, which would leave the user seeing
some intermediate step of the operation. This commit changes it to only
output it on detach if it didn't already output the same item.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: fde2329eaa1fab2327ae2e775af5aa04e2726ed5
Component: engine
2016-01-26 10:03:28 -08:00
bc025bbadc Merge pull request #19701 from aaronlehmann/remove-downloads-on-error
Remove temporary layer download file on error
Upstream-commit: 4158b671f3c5ac13605892aa31c0a9ed22f2e8fd
Component: engine
2016-01-26 10:55:43 +01:00
25849c48bc Merge pull request #19057 from dnephin/remove_version_from_registry_pkg
Remove dockerversion from registry package
Upstream-commit: 07e2dedecb3a0b7381ebf0f8fb4d08d082754cd0
Component: engine
2016-01-25 22:45:06 -08:00
1a98d85d03 Remove temporary layer download file on error
Currently, the temporary file storing downloaded layer data is only
removed after a successful download or a digest verification error. A
transport-level error does not cause it to be removed. This is a
regression from 1.9 that could cause disk usage to grow until the Docker
daemon is restarted.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 5a363ce60bee3dc26a433c7e2cee6dc76939849e
Component: engine
2016-01-25 18:20:18 -08:00
1edf55ab4c Fix watching a released transfer
Things could go wrong if Watch was called after the last existing
watcher was released. The call to Watch would succeed even though it was
not really adding a watcher, and the corresponding call to Release would
close hasWatchers a second time.

The fix for this is twofold:

1. We allow transfers to gain new watchers after the watcher count has
touched zero. This means that the channel returned by Released should
not be closed until all watchers have been released AND the transfer is
no longer tracked by the transfer manager, meaning it won't be possible
for additional calls to Watch to race with closing the channel returned
by Released.

The Transfer interface has a new method called Close so the transfer can
know when the transfer manager no longer references it.

Remove the Cancel method. It's not used and should not be exported.

2. Even though (1) makes it possible to add watchers after all the
previous watchers have been released, we want to avoid doing this in
practice. A transfer that has had all its watchers released is in the
process of being cancelled, and attaching to one of these will never be
the correct behavior. Add a check if a watcher is attaching to a
cancelled transfer.  In this case, wait for the transfer to be removed
from the map and try again. This will ensure correct behavior when a
watcher tries to attach during the race window.

Either (1) or (2) should be sufficient to fix the race involved here,
but the combination is the most correct approach. (1) fixes the
low-level plumbing to be resilient to the race condition, and (2) avoids
using it in a racy way.

Fixes #19606

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 3e2b50ccaadb5ecbd70bf27adc287973f0417573
Component: engine
2016-01-25 13:28:02 -08:00
5696850b38 Merge pull request #19509 from BrianBland/master
Fixes layer MediaTypes in manifests created from a cross-repository push
Upstream-commit: 2731dbc7977dba00405c974c47c4f079d441a2b2
Component: engine
2016-01-22 14:27:47 -05:00
91f8ed84f8 Merge pull request #19551 from aaronlehmann/fix-retry-on-enospc
Don't retry downloads when disk is full
Upstream-commit: 26334b7a7d80fe233f27773bb65ac2d57d3af2a0
Component: engine
2016-01-21 15:37:50 -05:00
305118a342 Don't retry downloads when disk is full
There was already a check that prevented protocol-level fallback in this
situation, but retries within a specific protocol will still happen.
This makes it take a long time for the pull to finally error out.

This fixes slowness in TestDaemonNoSpaceleftOnDeviceError, which used to
take a long time due to the backoff between retry attempts:

PASS: docker_cli_daemon_test.go:1868: DockerDaemonSuite.TestDaemonNoSpaceleftOnDeviceError	5.882s

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 4f13ec5551076505395ad5b1c099f47eca06e63e
Component: engine
2016-01-21 10:01:51 -08:00
569d5959b2 Unwrap URL errors on retry
When authorization errors are returned by the token process the error will be wrapped in url.Error.
In order to check the underlying error for retry this error message should be unwrapped.
Unwrapping this error allows failure to push due to an unauthorized response to keep from retrying, possibly resulting in later 429 responses.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: e9d5292b0c4a26ed51a66437b8ab0dba03f65b8f
Component: engine
2016-01-20 14:29:38 -08:00
24a40e97d1 Fixes layer MediaTypes in manifests created from a cross-repository push
Signed-off-by: Brian Bland <brian.bland@docker.com>
Upstream-commit: 06e9a056caa4a5fa8608dc94fecd62bafe528265
Component: engine
2016-01-20 12:23:16 -08:00
8a0c8b1a34 Revert reporting of multiple pull errors
Revert the portions of #17617 that report all errors when a pull
falls back, and go back to just reporting the last error. This was nice
to have, but causes some UX issues because nonexistent images show
additional "unauthorized" errors.

Keep the part of the PR that handled ENOSPC, as this appears to work
even without tracking multiple errors.

Fixes #19419

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 87338bf0fa97c905d2d707393c95f73aea398cad
Component: engine
2016-01-18 15:49:08 -08:00
a208c4a74e Remove the use of dockerversion from the registry package
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Upstream-commit: 61a49bb6ba2c0f17a31a64ee6336b4fc40c37f71
Component: engine
2016-01-15 12:43:54 -05:00
bcd131a7aa Changes cross-repository blob mounting to a blob Create option
Also renames BlobSumService to V2MetadataService, BlobSum to
V2Metadata

Signed-off-by: Brian Bland <brian.bland@docker.com>
Upstream-commit: 63099477189ea14f3122f6aa37fa7c60d33562c7
Component: engine
2016-01-14 14:26:03 -08:00
7afe53c8eb Adds cross-repository blob pushing behavior
Tracks source repository information for each blob in the blobsum
service, which is then used to attempt to mount blobs from another
repository when pushing instead of having to re-push blobs to the same
registry.

Signed-off-by: Brian Bland <brian.bland@docker.com>
Upstream-commit: 7289c7218e2101eb94fb90f2cb22e1412d016984
Component: engine
2016-01-13 14:26:30 -08:00
46b5818462 Merge pull request #18785 from aaronlehmann/new-manifest
New image manifest format
Upstream-commit: f11b6a2ab313a03d051dd6f69d264d0482df72d6
Component: engine
2016-01-11 12:01:46 -08:00
2250226bc8 Fix flaky test TestSuccessfulDownload
One of the things this test checks is that the progress indicator
completes for each download. Some progress messages may be lost because
only one message is buffered for each download, but the last progress
message is guaranteed not to be lost. The test therefore checks for a
10/10 progress indication.

However, the assumption that this is the last progress message to be
sent is incorrect. The last message is actually "Pull complete". So
check for this instead.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 0757a52737b283e56c9a8f5597e8b52c365ce1f6
Component: engine
2016-01-11 09:46:34 -08:00
f4d0dc32a0 Use RootFS from image config to register layers on Windows
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 7450c258abe01585f861f4a1b5d2b97539dbbdce
Component: engine
2016-01-08 17:27:31 -08:00
de6e714e78 Add support for manifest lists ("fat manifests")
A manifest list refers to platform-specific manifests. This allows
for images that target more than one architecture to share the same tag.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 2bb8c85bc5e59d2f5a154b58bb9a4b6e86775a40
Component: engine
2016-01-08 17:27:31 -08:00
17eed595ac Add schema2 push support
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: c8d277d228fbb4ec168a5d459c6e874cf9a872b3
Component: engine
2016-01-08 17:27:31 -08:00
e149f9fc4c Add schema2 pull support
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 94726f7c7391d990d3d15f88ea20dbe8fe23c958
Component: engine
2016-01-08 17:24:21 -08:00
c8cdbc5c42 Change push to use manifest builder
Currently this always uses the schema1 manifest builder. Later, it will
be changed to attempt schema2 first, and fall back when necessary.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: f33fa1b8d3befec31fdf1952ea1190012c812dc7
Component: engine
2016-01-08 17:24:21 -08:00
fbe586aef3 Update code to compile against new manifest interface
Also, digest.FromBytes no longer returns an error.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: c168a0059f56507731e59c0264d96b5a74f93507
Component: engine
2016-01-08 17:24:20 -08:00
d54e9ca21b Send push information to trust code out-of-band
The trust code used to parse the console output of `docker push` to
extract the digest, tag, and size information and determine what to
sign. This is fragile and might give an attacker control over what gets
signed if the attacker can find a way to influence what gets printed as
part of the push output.

This commit sends the push metadata out-of-band. It introduces an `Aux`
field in JSONMessage that can carry application-specific data alongside
progress updates. Instead of parsing formatted output, the client looks
in this field to get the digest, size, and tag from the push.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 65370be888d940899593a001024f53d6b83b4bb0
Component: engine
2016-01-08 10:57:50 -08:00
4ec2693c9e Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: 907407d0b2e5863f0e1b40b93a356bbf03c7b9fb
Component: engine
2016-01-06 19:48:59 -05:00
156d67e60e Merge pull request #18889 from aaronlehmann/v1-fallback-pull-all-tags
Allow v1 protocol fallback when pulling all tags from a repository unknown to v2 registry
Upstream-commit: 6c30931b06ff44e1ce002002430577b7135d2049
Component: engine
2016-01-05 16:20:04 -05:00
58e545b6bf Merge pull request #18888 from calavera/event_types
Event all the things!
Upstream-commit: 723be0a3325799fd6b2a6b689af54f5a07edf992
Component: engine
2016-01-04 13:07:33 -08:00
b58ec08634 Use constant instead of "scratch"
Move NoBaseImageSpecifier to a common spot and then use it instead of
"scratch" in a couple of places.

Signed-off-by: Doug Davis <dug@us.ibm.com>
Upstream-commit: e6806223e81c916c9b24580b19207271f1a36965
Component: engine
2015-12-31 06:21:56 -08:00