Commit Graph

358 Commits

Author SHA1 Message Date
4e8cadcb64 Merge pull request #15489 from aaronlehmann/pull-updates
Show pull progress in terminal for inflight pull requests
Upstream-commit: 84614fdae00fbdb66b5ae6de1c8246c470ef4f5c
Component: engine
2015-08-31 09:37:33 -07:00
f6d5f51a76 [daemon] Refactor image_delete.go
This file was not well documented and had very high cyclomatic complexity.
This patch completely rearranges this file and the ImageDelete method to
be easier to follow and more maintainable in the future.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 111d2f348767692a34366ff5cd01f607cf54ad57
Component: engine
2015-08-28 11:01:24 -07:00
49179849ea Remove "...already being pulled" messages
These don't get seen, so they are unnecessary.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 9b9d70ad271b46a67bde57b8a807121f6e85b75f
Component: engine
2015-08-27 13:22:08 -07:00
d4bbf5d640 Clean up ProgressStatus
- Rename to Broadcaster

- Document exported types

- Change Wait function to just wait. Writing a message to the writer and
  adding the writer to the observers list are now handled by separate
  function calls.

- Avoid importing logrus (the condition where it was used should never
  happen, anyway).

- Make writes non-blocking

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 26c9b585042ac7dce8db83478a69fd01a4b003d7
Component: engine
2015-08-27 13:22:08 -07:00
9802667a69 Merge pull request #15882 from vdemeester/14756-lint-opts-trust
Carry #14813 on linting package opts and trust
Upstream-commit: ba019dc0d0a89b3152fc3791495af2ddf18e173d
Component: engine
2015-08-27 15:58:13 -04:00
4366d3278e Change poolAdd to return a boolean instead of an error
Previously, its other return value was used even when it returned an
error. This is awkward and goes against the convention. It also could
have resulted in a nil pointer dereference when an error was returned
because of an unknown pool type. This changes the unknown pool type
error to a panic (since the pool types are hardcoded at call sites and
must always be "push" or "pull"), and returns a "found" boolean instead
of an error.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 80513d85cfc0e46f8202fc3030f11052bbfeea7a
Component: engine
2015-08-27 11:18:42 -07:00
2b816e64e2 Show pull progress in terminal for inflight pull requests
Based on #12874 from Sam Abed <sam.abed@gmail.com>. His original commit
was brought up to date by manually porting the changes in pull.go into
the new code in pull_v1.go and pull_v2.go.

Fixes #8385

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 572f008e892b06262963ccb75c631f2f5d6c6fcd
Component: engine
2015-08-27 11:18:40 -07:00
bab25931f6 Merge pull request #15646 from tonistiigi/15589-pull-cancellation
Fix pull on client disconnect
Upstream-commit: 0634c653d5214c7d8e5f1a154ce35d40ac8d25d7
Component: engine
2015-08-27 17:54:08 +02:00
a8d6119113 Finish linting opts and trust package.
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 0bd016b1c31f807169019d10a496144c34698431
Component: engine
2015-08-27 17:36:11 +02:00
cd1363a47b golint: trust
contributes to #14756

Signed-off-by: Sevki Hasirci <s@sevki.org>
Upstream-commit: 5572148477ad069989bc3301e662cd6ee44832d2
Component: engine
2015-08-27 11:40:27 +02:00
4602da3b1b Merge pull request #15493 from stevvooe/no-buffer-on-push
Avoid buffering to tempfile when pushing with V2
Upstream-commit: 70a814c3f378a5873aedf3be85397272de4f6672
Component: engine
2015-08-26 13:59:01 -07:00
15378abfc2 adding message option to the import subcommand
Signed-off-by: Taylor Jones <monitorjbl@gmail.com>
Upstream-commit: 936b2c6afe490b562df4ebea854b116c3b40a9f5
Component: engine
2015-08-25 02:55:04 +00:00
78b5767538 Avoid buffering to tempfile when pushing with V2
The practice of buffering to a tempfile during a pushing contributes massively
to slow V2 push performance perception. The protocol was actually designed to
avoid precalculation, supporting cut-through data push. This means we can
assemble the layer, calculate its digest and push to the remote endpoint, all
at the same time.

This should increase performance massively on systems with slow disks or IO
bottlenecks.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 349aef06d51a9425f70a877585fe45283366c2c4
Component: engine
2015-08-24 18:08:05 -07:00
69dbe5953f Merge pull request #15393 from azurezk/exportImage-toplevel
change exportImage to top-level func
Upstream-commit: 82e2dec06de63d85db14c954e472deffdd18c5b7
Component: engine
2015-08-24 14:35:55 -07:00
a45c2b3952 Merge pull request #15756 from tonistiigi/15724-remove-nil-contexts
Remove nil contexts
Upstream-commit: 25f4f5588e1b862f1f26a2e4edb57807a9affda4
Component: engine
2015-08-24 14:29:48 -07:00
32eed5b907 Mitigate parallel pull issues
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: b779bc31022fddd165ac7d919cb06d78288a93c9
Component: engine
2015-08-24 11:41:45 -07:00
84c411f6f2 Merge pull request #15735 from tonistiigi/graph-register-readcloser
Make graph.Register take in io.Reader
Upstream-commit: 1544c5edb6fc796918a0bc2968a48df4e23a9fdb
Component: engine
2015-08-24 10:40:04 -07:00
9c87b64804 Remove nil contexts
Causes daemon panic because loggers can’t be found.

Fixes #15724

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 0c08913d523da2a935e65ade93884194c1906991
Component: engine
2015-08-21 10:31:27 -07:00
aa86f75147 Merge pull request #15754 from mountkin/fix-return
modify a return value in graph/tags.go to increase readability
Upstream-commit: 85bef48bf5a0c781cfa6418fa63318a94032efc7
Component: engine
2015-08-21 10:55:50 -04:00
226177670d modify a return value in graph/tags.go to increase readability
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: f11b7acc73b333eb480d2520f703f0a9c50d0a0e
Component: engine
2015-08-21 21:36:30 +08:00
d84f50c157 Make graph.Register take in io.Reader
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 2d1158790dc56df6d2b39a9c94acf34d62299b91
Component: engine
2015-08-20 20:37:11 -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
73f39654a9 Windows: Graph remove custom interface and add central store
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>

Windows: add support for images stored in alternate location.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: dfbb5520e3b35030f3eef38d5a2d86ad20ea0a2f
Component: engine
2015-08-14 23:45:53 -07:00
da97ba6880 Merge pull request #15545 from LK4D4/refactor_pullv2
Refactoring of pullV2Tag
Upstream-commit: b93d99b25d2d0797d985c4529292435c74da75c3
Component: engine
2015-08-13 15:52:14 -07:00
f1cc5568e9 Merge pull request #13501 from vdemeester/8048-image-repository-tag
Fix #8048 : make `docker images repository:tag` work
Upstream-commit: c6c195a465652e96b06e76b44a1df075cba9ad80
Component: engine
2015-08-13 21:36:21 +02:00
8771bcf9d5 Refactoring of pullV2Tag
* use downloadInfo pointers everywhere
* use downloads slice only for things that we really download
* cleanup tmp files in all cases

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 9b2426c606b92fa37b7484d9d884edd43352b69c
Component: engine
2015-08-13 11:50:19 -07:00
b52277b7fd fix a typo in graph/graph.go
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
Upstream-commit: 883fcfe4256d5d5bf1b3bfbced61fa585fe07a73
Component: engine
2015-08-13 20:01:43 +08:00
d024131050 Fix #8048 : make docker images repository:tag work
Make command like "docker images ubuntu:14.04" work and filter out the
image with the given tag.

Closes #8048.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 4fb88d2e11f2f16c520b36e4c6e00db44ae26b8c
Component: engine
2015-08-13 08:50:09 +02:00
6585a8728e Revert #14884
This reverts commit 810d3b2642d4a82dc186d6eff8c2e487ee624bc5.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 4f3b0d0f4ad046a5180f524ba320990c67282dd0
Component: engine
2015-08-12 18:46:48 -07:00
33a35ed586 change exportImage to top-level func
Signed-off-by: Kun Zhang <zkazure@gmail.com>

remove useless FIXME

Signed-off-by: Kun Zhang <zkazure@gmail.com>

fix

Signed-off-by: Kun Zhang <zkazure@gmail.com>
Upstream-commit: a7c00bc1a23571dbd5e0085aac22a0e5b0d5fe40
Component: engine
2015-08-10 22:18:57 +08:00
c8706706f4 Merge pull request #14897 from WeiZhang555/golint-api-types
fix golint warnings/errors on package api/types/
Upstream-commit: 0a0e9701f7bbe58e75eff9d1934fde0a5038ee9c
Component: engine
2015-08-07 10:51:27 -07:00
8778d71536 Merge pull request #14828 from brahmaroutu/lint_graph_tags
/graph/tag fix lint errors/warnings
Upstream-commit: b1009d1fdd551a57e7c266d9cc8122ed3f80aa2c
Component: engine
2015-08-07 10:49:26 -07:00
502a6d4faf fix golint warnings/errors on package api/types/
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 3d6617ffe7d9242107ac09eab4f2d8ce87acb95c
Component: engine
2015-08-07 09:43:43 +08:00
9970a2eed5 registry: Do not push to mirrors
This patch splits LookupEndpoints into LookupPullEndpoints and
LookupPushEndpoints so that mirrors added with --registry-mirror are
skipped in the list returned by LookupPushEndpoints.

Fixes https://github.com/docker/distribution/issues/823

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: b899977ee283d6bccf35ad9a079ed92a291ad34c
Component: engine
2015-08-06 17:41:59 -04:00
fc48931914 [graph] Use a pipe for downloads to write progress
The process of pulling an image spawns a new goroutine for each layer in the
image manifest. If any of these downloads fail we would stop everything and
return the error, even though other goroutines would still be running and
writing output through a progress reader which is attached to an http response
writer. Since the request handler had already returned from the first error,
the http server panics when one of these download goroutines makes a write to
the response writer buffer.

This patch prevents this crash in the daemon http server by waiting for all of
the download goroutines to complete, even if one of them fails. Only then does
it return, terminating the request handler.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: d80c4244d322fe0a9cbdd996d23e37fb5b089544
Component: engine
2015-08-05 18:13:39 -07:00
9d9a4fd0c0 Merge pull request #15252 from coolljt0725/14765_enable_golint_3
Enable golint in pkg/archive
Upstream-commit: 8534090476b6eae66f1eca81e8bc0e0c61ed7197
Component: engine
2015-08-05 19:27:48 -04:00
65b70bf683 /graph/tag fix lint errors/warnings
Addresses #14756
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: d9b261221aa6ada89a2dac3e535cb1d48be37cad
Component: engine
2015-08-05 17:46:41 +00:00
5dd4ca1927 Windows: Fix docker/master daemon compile again
Signed-off-by: John Howard <jhoward@microsoft.com>
Upstream-commit: 67e670b79f1ed372b62058ebadd5821fa85cd737
Component: engine
2015-08-04 19:32:05 -07:00
aa73b79fe2 Merge pull request #14921 from aaronlehmann/int64
Fix uses of "int" where "int64" should be used instead
Upstream-commit: 7374852be9def787921aea2ca831771982badecf
Component: engine
2015-08-04 19:16:13 -07:00
3ba45e7906 Enable golint in pkg/arcive
Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: ba332b7d12fba16e8c604728a44986886eeb07d6
Component: engine
2015-08-04 09:52:54 +08:00
d08d95f41d [graph] Enforce manifest/layer digest verification
We noticed a regression since the 1.7.1 patch after some refactoring. This
patch corrects the behavior and adds integration tests for modified manifest
and rootfs layer blobs.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: de52a3bcaa1742054be184cc3465f0933f6d383a
Component: engine
2015-08-03 11:41:23 -07:00
761b152e62 Fix uses of "int" where "int64" should be used instead
Some structures use int for sizes and UNIX timestamps. On some
platforms, int is 32 bits, so this can lead to the year 2038 issues and
overflows when dealing with large containers or layers.

Consistently use int64 to store sizes and UNIX timestamps in
api/types/types.go. Update related to code accordingly (i.e.
strconv.FormatInt instead of strconv.Itoa).

Use int64 in progressreader package to avoid integer overflow when
dealing with large quantities. Update related code accordingly.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 1f61084d83aea37b212468aaa975020094b7f7c9
Component: engine
2015-07-31 16:31:40 -07:00
03122f024f Merge pull request #15144 from aaronlehmann/graph-cleanup
Documentation improvements and code cleanups for graph package
Upstream-commit: 8f2dca538619372663a94bc5141dbc7f121defb8
Component: engine
2015-07-31 15:11:34 -07:00
c5a5900eb9 Documentation improvements and code cleanups for graph package
Expand the godoc documentation for the graph package.

Centralize DefaultTag in the graphs/tag package instead of defining it
twice.

Remove some unnecessary "config" structs that are only used to pass
a few parameters to a function.

Simplify the GetParentsSize function - there's no reason for it to take
an accumulator argument.

Unexport some functions that aren't needed outside the package.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: d4836cd7ec1c085c5a5caa7eb7f5eda4ace10eb6
Component: engine
2015-07-30 14:27:10 -07:00
3c8e934faf Simplify and fix os.MkdirAll() usage
TL;DR: check for IsExist(err) after a failed MkdirAll() is both
redundant and wrong -- so two reasons to remove it.

Quoting MkdirAll documentation:

> MkdirAll creates a directory named path, along with any necessary
> parents, and returns nil, or else returns an error. If path
> is already a directory, MkdirAll does nothing and returns nil.

This means two things:

1. If a directory to be created already exists, no error is returned.

2. If the error returned is IsExist (EEXIST), it means there exists
a non-directory with the same name as MkdirAll need to use for
directory. Example: we want to MkdirAll("a/b"), but file "a"
(or "a/b") already exists, so MkdirAll fails.

The above is a theory, based on quoted documentation and my UNIX
knowledge.

3. In practice, though, current MkdirAll implementation [1] returns
ENOTDIR in most of cases described in #2, with the exception when
there is a race between MkdirAll and someone else creating the
last component of MkdirAll argument as a file. In this very case
MkdirAll() will indeed return EEXIST.

Because of #1, IsExist check after MkdirAll is not needed.

Because of #2 and #3, ignoring IsExist error is just plain wrong,
as directory we require is not created. It's cleaner to report
the error now.

Note this error is all over the tree, I guess due to copy-paste,
or trying to follow the same usage pattern as for Mkdir(),
or some not quite correct examples on the Internet.

[v2: a separate aufs commit is merged into this one]

[1] https://github.com/golang/go/blob/f9ed2f75/src/os/path.go

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Upstream-commit: a83a76934787a20e96389d33bd56a09369f9b808
Component: engine
2015-07-30 11:48:08 -07:00
e1b2148585 /graph fix lin errors/warnings
Addresses #14756
Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>
Upstream-commit: 1d6e44311916b26e1cd128e96ea9f0e5ede5f9df
Component: engine
2015-07-29 20:59:36 +00:00
67bf5ba305 Replace GenerateRandomID with GenerateNonCryptoID
This allow us to avoid entropy usage in non-crypto critical places.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 6bca8ec3c9ccc169c53b3d7060fe5c8ba8670aac
Component: engine
2015-07-28 22:31:01 -07:00
0fccf757d0 Format times in inspect command with a template as RFC3339Nano
In 1.6.2 we were decoding inspect API response into interface{}.
time.Time fields were JSON encoded as RFC3339Nano in the response
and when decoded into interface{} they were just strings so the inspect
template treated them as just strings.
From 1.7 we are decoding into types.ContainerJSON and when the template
gets executed it now gets a time.Time and it's formatted as
2015-07-22 05:02:38.091530369 +0000 UTC.
This patch brings back the old behavior by typing time.Time fields
as string so they gets formatted as they were encoded in JSON -- RCF3339Nano

Signed-off-by: Antonio Murdaca <runcom@linux.com>
Upstream-commit: c9207bc0aa57745876a3422d2cbc290be7c53da8
Component: engine
2015-07-26 15:25:08 +02:00
7e6fe45a4f Use notary library for trusted image fetch and signing
Add a trusted flag to force the cli to resolve a tag into a digest via the notary trust library and pull by digest.
On push the flag the trust flag will indicate the digest and size of a manifest should be signed and push to a notary server.
If a tag is given, the cli will resolve the tag into a digest and pull by digest.
After pulling, if a tag is given the cli makes a request to tag the image.

Use certificate directory for notary requests

Read certificates using same logic used by daemon for registry requests.

Catch JSON syntax errors from Notary client

When an uncaught error occurs in Notary it may show up in Docker as a JSON syntax error, causing a confusing error message to the user.
Provide a generic error when a JSON syntax error occurs.

Catch expiration errors and wrap in additional context.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Upstream-commit: ed13c3abfb242905ec012e8255dc6f26dcf122f6
Component: engine
2015-07-24 14:08:20 -07:00
4d9279a3fb Improve documentation and golint compliance of registry package
* Add godoc documentation where it was missing

* Change identifier names that don't match Go style, such as INDEX_NAME

* Rename RegistryInfo to PingResult, which more accurately describes
  what this structure is for. It also has the benefit of making the name
  not stutter if used outside the package.

Updates #14756

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Upstream-commit: 4fcb9ac40ce33c4d6e08d5669af6be5e076e2574
Component: engine
2015-07-24 11:55:07 -07:00