Commit Graph

80 Commits

Author SHA1 Message Date
2bb8a5be97 Use current windows servercore image
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
(cherry picked from commit aad7e9797b2e9a980b28d7d77bc119cb4b7e57dc)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 04d0295c0cdfe3e67ab51ca611e3a7dd8a49b668
Component: engine
2019-04-18 18:06:44 +02:00
45b389fec8 Replace some checkers and assertions with gotest.tools
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 6345208b9b067f19f7792edcc675f59a617a3ca5)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 9a4d7bb0e25169fa7d48e24777c683587c29c25a
Component: engine
2019-04-17 23:10:05 +02:00
099ae9b4b0 Disallow using legacy (V1) registries
Interacting with v1 registries was deprecated in Docker 1.8.3, disabled by default
in Docker 17.06, and scheduled for removal in Docker 17.12.

This patch disallows enabling V1 registry through the `--disable-legacy-registry`
option, and the `"disable-legacy-registry": false` option in the daemon configuration
file. The actual V1 registry code is still in place, and will be removed separately.

With this patch applied:

    $ dockerd --disable-legacy-registry=false
    ERROR: The '--disable-legacy-registry' flag has been removed. Interacting with legacy (v1) registries is no longer supported

Or, when setting through the `daemon.json` configuration file

    $ mkdir -p /etc/docker/
    $ echo '{"disable-legacy-registry":false}' > /etc/docker/daemon.json
    $ dockerd
    ERROR: The 'disable-legacy-registry' configuration option has been removed. Interacting with legacy (v1) registries is no longer supported

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 8d6df8a0addc9a37b48c5a1827dd3f65f2ed57cf
Component: engine
2017-12-09 02:24:43 -08:00
3242c0b622 Fix tests creating zombie processes
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 617f89b9a357c0176efc2b5b28af8b36f5ebdbcb
Component: engine
2017-10-20 07:11:38 -07:00
023fe0b32f [integration-cli] fix p/z HubPullSuite tests
This test tries to pull all the tags in the busybox repo and looks to see
if there were more than two images pulled. This was failing on
p/z due to the recent change to manifest lists, where one of the busybox
tags didn't have a p/z manifest in it's manifest list.

This error seems fine to me, so I changed the test to see if pull fails,
it fails with the "manifest not found" error.

Also switched from busybox -> alpine, because it has significantly less tags,
and the images are close in size.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: 5739ba1b918402b8eda748ac2f5dd7ce00f2e69f
Component: engine
2017-09-14 09:42:09 -04:00
806d838e90 LCOW: Spot fix for multi-os image pulling
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: b291f5a31728f7ff6386bb37f15e7c0885d3b2a7
Component: engine
2017-09-12 23:33:34 -07: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
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
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
be857bf709 Block Windows images on Linux
Signed-off-by: Darren Stahl <darst@microsoft.com>
Upstream-commit: d55304065b8de2adf9a18e195ca9224e3c04a7ca
Component: engine
2017-02-02 11:07:30 -08:00
775c5633ef *: use opencontainers/go-digest package
The `digest` data type, used throughout docker for image verification
and identity, has been broken out into `opencontainers/go-digest`. This
PR updates the dependencies and moves uses over to the new type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 7a855799175b6b984886ef1cfa337d6df1d4c668
Component: engine
2017-01-06 18:48:41 -08:00
2758f0996d Remove pkg/integration and move it to testutil or integration-cli
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 33968e6c7df164fff0a882c50ae7f4f7e6190e4b
Component: engine
2016-12-30 18:26:34 +01:00
44fa4f8ae7 duplicated the
Signed-off-by: Jie Luo <luo612@zju.edu.cn>

typo

Signed-off-by: Jie Luo <luo612@zju.edu.cn>

fix some typos

Signed-off-by: Jie Luo <luo612@zju.edu.cn>
Upstream-commit: ea2dd4b5d0b41552d047814d9e39ddaa3662ab41
Component: engine
2016-12-21 20:16:19 +08:00
47bad37f72 Add class to repository scope
Expose registry error translation for plugin distribution

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: a12b466183e03621bc9e1c1e4deab6db8ec93f0a
Component: engine
2016-11-21 22:18:50 -08:00
3fc4b494de Update pull error handling
Translate pull errors to provide a more consistent and user friendly
error message.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 19a93a6e3d4213c56583bb0c843cf9e33d379752
Component: engine
2016-11-10 17:34:12 -08:00
e66566fbee Windows: Fix regression pulling linux images
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 8437d0a3298abf8bf3632a2764b945956ece422f
Component: engine
2016-09-09 11:40:34 -07:00
fb1770417a Move implicit pull test to use local registry
Using hub only works for amd64 platforms.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 641c1808e187ed86d8b614e49e8e6da5146201e3
Component: engine
2016-05-02 18:14:13 -07:00
9fb835ad73 Fix #22240 do not pull all the tags implicitely
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 54ebe42de9c359e0c9f171953bd787bb997d719e
Component: engine
2016-05-01 14:46:04 +02:00
eef44cf65d Change v1 pull 404 message to include tag
The current error message is "Error: image [name] not found". This makes
sense from the perspective of the v1 pull, since we found the repository
doesn't exist over the v1 protocol. However, in the vast majority of
cases, this error will be produced by fallback situations, where we
first try to pull the tag with the v2 protocol, and then fall back the
v1 protocol, which probably isn't even supported by the server.
Including the tag in the error message makes a lot more sense since the
actual repository may exist on v2, but not the tag.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 745892a7b271cf0f1770a8ec3698aaf61573e5f2
Component: engine
2016-03-29 10:04:59 -07:00
f9e5200e21 distribution: errors: do not access the errors slice if it's empty
- cherry-pick from 1.10.3 branch: 0186f4d4223a094a050d06f456355da3ae431468
- add token service test suite
- add integration test (missing in 1.10.3 branch)

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 1b5c2e1d722757a55364fb45cf3fcec7f2c75fb4
Component: engine
2016-03-16 09:00:39 +01:00
cad593b9ac integration-cli: add tests for case a) and d) in #21054
- add test for pull from private registry with no credentials
- add test for push to docker hub with no credentials

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Signed-off-by: Antonio Murdaca <amurdaca@localhost.localdomain>
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
Upstream-commit: 6d23c3c57a733436d902b7883f2f0b00846df9e2
Component: engine
2016-03-14 12:43:10 +01:00
27ef35473a Optimize slow bottleneck test of DockerHubPullSuite.TestPullNonExistingImage.
This PR fix the DockerHubPullSuite.TestPullNonExistingImage test
in #19425. The majority of the execution time in this test is
from multiple executions of 'docker pull', each of which takes
more than one second even though it tries to pull a non-existing
image.
Without changing the behavior of the 'docker pull' itself, this
fix tries to execute the 'docker pull' command in parallel in
order to speed up the execution of the overall test.
Since each 'docker pull' is independent, executions in parallel
should not alter the purpose of the test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 461976d2affe3ed4a354608d1dcb266e06f1d2b9
Component: engine
2016-03-03 14:51:54 +00:00
213ab0aa23 Another attempt to deflake TestPullFromCentralRegistryImplicitRefParts
Retries after v1 fallbacks were added in #20411. The test still appears
to be flaky. There are two potential problems. The initial pull was not
protected against pulling from v1, so it could be giving us a different
hello-world image to compare against. Also, after experiencing a v1
fallback, we need to restore the original image before doing the next
pull, because otherwise the "Image is up to date for hello-world:latest"
message will not show up as expected.

See #17214.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 0d270cadd4b65623b1f1ae02c4fe5bcc5f81fcd3
Component: engine
2016-03-01 17:02:06 -08:00
e1d1f67bc5 Improve resilience of TestPullFromCentralRegistryImplicitRefParts
Sometimes transient network issues will cause
TestPullFromCentralRegistryImplicitRefParts to end up pulling with the
v1 protocol. This violates the assumptions behind the test. To make the
test more robust, allow a few retries if any pull ends up using the v1
protocol.

Fixes #17214

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 884201115315abb0c7815e44e6728e590476aeb8
Component: engine
2016-02-17 13:08:51 -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
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
440e6d5df7 Merge pull request #18714 from jecarey/16756-docker_cli_pull_test
Use of checkers in docker_cli_pull_test.go
Upstream-commit: 51fa287368205e1f043d632e5930b7cce08a2419
Component: engine
2015-12-30 10:00:41 -08:00
04c33e2ef9 Allow v1 protocol fallback when pulling all tags from a repository unknown to v2 registry
This is a followup to #18839. That PR relaxed the fallback logic so that
if a manifest doesn't exist on v2, or the user is unauthorized to access
it, we try again with the v1 protocol. A similar special case is needed
for "pull all tags" (docker pull -a). If the v2 registry doesn't
recognize the repository, or doesn't allow the user to access it, we
should fall back to v1 and try to pull all tags from the v1 registry.
Conversely, if the v2 registry does allow us to list the tags, there
should be no fallback, even if there are errors pulling those tags.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 589a5226e7d4880ab7afa9e31202849db08a4bfa
Component: engine
2015-12-23 15:21:43 -08:00
ccad5598d4 When a manifest is not found, allow fallback to v1
PR #18590 caused compatibility issues with registries such as gcr.io
which support both the v1 and v2 protocols, but do not provide the same
set of images over both protocols. After #18590, pulls from these
registries would never use the v1 protocol, because of the
Docker-Distribution-Api-Version header indicating that v2 was supported.

Fix the problem by making an exception for the case where a manifest is
not found. This should allow fallback to v1 in case that image is
exposed over the v1 protocol but not the v2 protocol.

This avoids the overly aggressive fallback behavior before #18590 which
would allow protocol fallback after almost any error, but restores
interoperability with mixed v1/v2 registry setups.

Fixes #18832

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 9d6acbee92016c47796ee8751dce9c59056f850d
Component: engine
2015-12-21 18:19:38 -08:00
def74d9c92 Use of checkers in docker_cli_pull_test.go
Signed-off-by: James Carey <jecarey@us.ibm.com>
Upstream-commit: 1b010516d09fb587999eff6abb69cc76b25f7944
Component: engine
2015-12-21 14:04:38 -06:00
d2691dfadc Do not fall back to the V1 protocol when we know we are talking to a V2 registry
If we detect a Docker-Distribution-Api-Version header indicating that
the registry speaks the V2 protocol, no fallback to V1 should take
place.

The same applies if a V2 registry operation succeeds while attempting a
push or pull.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: a57478d65f1f5782cc746c260f9d841a0907ce54
Component: engine
2015-12-16 15:02:03 -08:00
547342d777 Improved push and pull with upload manager and download manager
This commit adds a transfer manager which deduplicates and schedules
transfers, and also an upload manager and download manager that build on
top of the transfer manager to provide high-level interfaces for uploads
and downloads. The push and pull code is modified to use these building
blocks.

Some benefits of the changes:

- Simplification of push/pull code
- Pushes can upload layers concurrently
- Failed downloads and uploads are retried after backoff delays
- Cancellation is supported, but individual transfers will only be
  cancelled if all pushes or pulls using them are cancelled.
- The distribution code is decoupled from Docker Engine packages and API
  conventions (i.e. streamformatter), which will make it easier to split
  out.

This commit also includes unit tests for the new distribution/xfer
package. The tests cover 87.8% of the statements in the package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 572ce802306a4e919802e5b77cbeca94acda7c0a
Component: engine
2015-12-09 19:13:35 -08:00
7d8daf7bad Fix flaky test TestPullAllTagsFromCentralRegistry
This test was directly comparing lines of output from "docker images".
Sometimes, when busybox had been pushed to the hub recently, the
relative creation times would differ like this:

... obtained []string = []string{"busybox", "latest", "d9551b4026f0", "27", "minutes", "ago", "1.113", "MB"}
... expected []string = []string{"busybox", "latest", "d9551b4026f0", "26", "minutes", "ago", "1.113", "MB"}

Fixing by removing the time-since-creation fields from the comparison.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: d17669999fff55219f5ed236f00fdf8a08d09304
Component: engine
2015-12-08 11:23:04 -08:00
e105a29374 Update daemon and docker core to use new content addressable storage
Add distribution package for managing pulls and pushes. This is based on
the old code in the graph package, with major changes to work with the
new image/layer model.

Add v1 migration code.

Update registry, api/*, and daemon packages to use the reference
package's types where applicable.

Update daemon package to use image/layer/tag stores instead of the graph
package

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 4352da7803d182a6013a5238ce20a7c749db979a
Component: engine
2015-11-24 09:40:25 -08:00
eb67a37877 Calculate hash based image IDs on pull
Generate a hash chain involving the image configuration, layer digests,
and parent image hashes. Use the digests to compute IDs for each image
in a manifest, instead of using the remotely specified IDs.

To avoid breaking users' caches, check for images already in the graph
under old IDs, and avoid repulling an image if the version on disk under
the legacy ID ends up with the same digest that was computed from the
manifest for that image.

When a calculated ID already exists in the graph but can't be verified,
continue trying SHA256(digest) until a suitable ID is found.

"save" and "load" are not changed to use a similar scheme. "load" will
preserve the IDs present in the tar file.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 504e67b867865a2835e8002c01087a2cfd7bfd0e
Component: engine
2015-10-12 10:51:28 -07:00
3d19f9af55 Add unit tests for integration cli utils function
- utils_test.go and docker_utils_test.go
- Moved docker related function to docker_utils.go
- add a test for integration-cli/checker

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 5109071706cab06257b21172627ce51e5fa3a88c
Component: engine
2015-09-09 15:36:44 +02:00
c03ccb6893 Windows: Get Integration CLI running
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: f9a3558a9d75ed6a2f9f1b2d80800226afaa74a5
Component: engine
2015-09-04 12:32:40 -07:00
0249cbd7d9 Update image pull tests
Update and migrate existing tests to the `DockerHubPullSuite`. Most
tests were preserved, but refactored and made more exhaustive. One test
was deliberately removed (`TestPullVerified`) as it is unreliable and
that the feature was obsoleted by content trust.

Move all trust related tests to `docker_cli_pull_trusted_test.go`.

Move tests depending on a local registry to `docker_cli_pull_local_test.go`.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: f324f4851f28edfd8dab82cd624a4ec1f01cd207
Component: engine
2015-09-03 15:57:41 -07:00
190c9ba004 Use DockerSuite for PullClientDisconnect test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 9dd6c8822ddccff1952dfd611263ba551693ff7d
Component: engine
2015-08-27 11:22:54 -07:00
2a748ae2e6 Fix pull on client disconnect
Fixes #15589

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 8eeafa058c762b303436422a4682c364fe469985
Component: engine
2015-08-18 09:41:37 -07:00
4c1bdea55d Skip notary tests which update system clock
Currently some notary tests change the system clock to check for expiration.
Skip these tests until the code can be refactored to not rely on updating the system clock.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: bf3c1e6a3afc951e41643b8d55d4ac25fa9cb06d
Component: engine
2015-07-29 12:09:40 -07:00
6e14356132 Don't pass check.C to dockerCmdWithError
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 693ba98cb9118bf15caaabc69ca281c0ce604226
Component: engine
2015-07-27 14:33:32 -04:00
99a373ceb8 Rename to flags and environment variables to content trust
Update help line to allow 90 characters instead of 80

The trust flag pushes out the help description column wider, requiring more room to display help messages.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 259cadb0b19a9049302e78fec529b0105efabb1d
Component: engine
2015-07-24 16:31:18 -07:00
e5887c6923 Added tests for expired snapshots and timestamps
Signed-off-by: Diogo Monica <diogo@docker.com>
Upstream-commit: 3e90b12d42f6f937639edafa4b2ddc12badf8895
Component: engine
2015-07-24 16:31:18 -07:00
937cba2db1 Add tests simulating an evil server
Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
Upstream-commit: 268fa5af4768f7b1df32501d5f7ba0daba2c2da1
Component: engine
2015-07-24 16:31:18 -07:00
97834446bf Add build integration cli tests
Clean up tests to remove duplicate code

Add tests which run pull and create in an isolated configuration directory.
Add build test for untrusted tag

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 871d2b96ed5cf234c41a5e731a34fc9deda4e9f1
Component: engine
2015-07-24 16:31:12 -07:00
08efdea505 Add test for incorrect nonroot passphrase
Fix failing tests for create, push, and pull

Signed-off-by: Diogo Monica <diogo@docker.com>
Upstream-commit: eeb6d0a71b754c1c99748f7ba08be27e4d8b8eb9
Component: engine
2015-07-24 14:08:20 -07:00
be6fe06878 Add trust tests for Docker create, run, push, and pull
Created date util function

Signed-off-by: Nathan McCauley <nathan.mccauley@docker.com>
Upstream-commit: 1406cb35fd814a987b91f92ed1a4b61a21205736
Component: engine
2015-07-24 14:08:20 -07:00
5eae9c3c28 Add more integration tests for trusted push and pull
Signed-off-by: Diogo Monica <diogo@docker.com>
Upstream-commit: 356b07c89602e4f5e9c9d4c53ec24b341b4e7865
Component: engine
2015-07-24 14:08:20 -07:00
b82ed8bb95 Add integration cli trust tests
Added notary server to docker base image.
Created trust suite which runs trust server for running trusted commands.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: 58a1de9b59594948df152f0003e759b77bcaa56a
Component: engine
2015-07-24 14:08:20 -07:00