Commit Graph

31 Commits

Author SHA1 Message Date
David Calavera 907407d0b2 Modify import paths to point to the new engine-api package.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-01-06 19:48:59 -05:00
Phil Estes 6c30931b06 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
2016-01-05 16:20:04 -05:00
David Calavera 723be0a332 Merge pull request #18888 from calavera/event_types
Event all the things!
2016-01-04 13:07:33 -08:00
Doug Davis e6806223e8 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>
2015-12-31 06:21:56 -08:00
David Calavera 72f1881df1 Add event types.
- Stop serializing JSONMessage in favor of events.Message.
- Keep backwards compatibility with JSONMessage for container events.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-30 17:39:33 -05:00
Arnaud Porterie 7b540ee653 Merge pull request #18877 from dnephin/move_graph_driver_to_layer_store
Move graph driver to layer store
2015-12-29 12:19:02 -08:00
Huanzhong Zhang 85e355605a print the registry name.
Signed-off-by: Huanzhong Zhang <zhanghuanzhong90@gmail.com>
2015-12-29 13:33:04 +08:00
Daniel Nephin f5916b10ae Remove the graph driver from the daemon, move it into the layer store.
Support restoreCustomImage for windows with a new interface to extract
the graph driver from the LayerStore.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-12-28 12:55:48 -05:00
Aaron Lehmann 589a5226e7 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>
2015-12-23 15:21:43 -08:00
Derek McGowan d04fa49a0d Refactor RWLayer to use referenced object instead of string
RWLayer will now have more operations and be protected through a referenced type rather than always looked up by string in the layer store.
Separates creation of RWLayer (write capture layer) from mounting of the layer.
This allows mount labels to be applied after creation and allowing RWLayer objects to have the same lifespan as a container without performance regressions from requiring mount.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-12-23 11:19:17 -08:00
Aaron Lehmann 9d6acbee92 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>
2015-12-21 18:19:38 -08:00
Aaron Lehmann 891bbc17ec Make v1 pull/push output consistent with v2
- Use layer DiffIDs for progress output in v1 push. This makes the
  output consistent with v2 pushes, which means that a fallback to v1
  won't start progress bars for a different set of IDs.

- Change wording used in v1 status updates to be consistent with v2.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-12-16 15:02:24 -08:00
Aaron Lehmann a57478d65f 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>
2015-12-16 15:02:03 -08:00
Tonis Tiigi eeb2d4c1ad Clean up reference type switches
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-12-16 11:58:53 -08:00
Tonis Tiigi ffded61dad Update Named reference with validation of conversions
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-12-16 11:58:52 -08:00
Tonis Tiigi 2655954c2d Add own reference package wrapper
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-12-16 11:58:52 -08:00
Antonio Murdaca bb2c92355c Merge pull request #18655 from dmcgowan/fix-docker-inspect-container
Add metadata function to layer store
2015-12-16 12:23:41 +01:00
huanzhong zhang badfc7e10f The logName is confused here, it's a localName actually.
Signed-off-by: huanzhong zhang <zhanghuanzhong90@gmail.com>
2015-12-15 15:21:28 +08:00
Derek McGowan a7e0968321 Add metadata function to layer store
Add function to get metadata from layer store for a mutable layer

fixes #18614

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2015-12-14 16:52:15 -08:00
Daniel Nephin 96c10098ac Move IndexInfo and ServiceConfig types to api/types/registry/registry.go
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-12-14 11:28:02 -05:00
Daniel Nephin 5b321e3287 Move AuthConfig to api/types
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-12-14 11:22:01 -05:00
Justas Brazauskas 927b334ebf Fix typos found across repository
Signed-off-by: Justas Brazauskas <brazauskasjustas@gmail.com>
2015-12-13 18:04:12 +02:00
Aaron Lehmann 572ce80230 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>
2015-12-09 19:13:35 -08:00
Aaron Lehmann 741924384e Use DiffSize instead of Size in v1 push
The v1 push code was querying the size of the layer chain up to the
layer it was pushing, rather than just that layer. This made the
progress indicator inaccurate.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-12-07 11:30:05 -08:00
Sebastiaan van Stijn 715f6a135c Merge pull request #17741 from dhiltgen/pull_token
Add token pass-thru for AuthConfig
2015-12-06 16:40:06 +01:00
Aaron Lehmann 39589800b4 Avoid a HEAD request for each layer in a v2 pull
We were calling Stat for each layer to get the size so we could indicate
progress, but https://github.com/docker/distribution/pull/1226 made it
possible to get the length from the GET request that Open initiates.

Saving one round-trip per layer should make pull operations slightly
faster and more robust.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-12-04 09:32:16 -08:00
Daniel Hiltgen 8dce8e9901 Add token pass-thru for AuthConfig
This change allows API clients to retrieve an authentication token from
a registry, and then pass that token directly to the API.

Example usage:

    REPO_USER=dhiltgen
    read -s PASSWORD
    REPO=privateorg/repo
    AUTH_URL=https://auth.docker.io/token
    TOKEN=$(curl -s -u "${REPO_USER}:${PASSWORD}" "${AUTH_URL}?scope=repository:${REPO}:pull&service=registry.docker.io" |
        jq -r ".token")

    HEADER=$(echo "{\"registrytoken\":\"${TOKEN}\"}"|base64 -w 0 )
    curl -s -D - -H "X-Registry-Auth: ${HEADER}" -X POST "http://localhost:2376/images/create?fromImage=${REPO}"

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
2015-12-03 11:40:27 -08:00
Brian Goff 9ebf7dfae3 Merge pull request #18252 from aaronlehmann/tarstream-readcloser
Make TarStream return an io.ReadCloser
2015-11-25 21:35:21 -05:00
Aaron Lehmann 21278efaee Make TarStream return an io.ReadCloser
Currently, the resources associated with the io.Reader returned by
TarStream are only freed when it is read until EOF. This means that
partial uploads or exports (for example, in the case of a full disk or
severed connection) can leak a goroutine and open file. This commit
changes TarStream to return an io.ReadCloser. Resources are freed when
Close is called.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-11-25 16:39:54 -08:00
Tonis Tiigi 20e759ab56 Validate adding digests to tagstore with go types
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2015-11-25 15:06:51 -08:00
Aaron Lehmann 694df3ff9f Add distribution package
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
2015-11-24 09:40:24 -08:00