summaryrefslogtreecommitdiff
path: root/distribution/errors.go
Commit message (Collapse)AuthorAgeFilesLines
* distribution: Error when pulling OCI artifactsPaweł Gronowski2022-11-021-1/+16
| | | | | | | | | | | Currently an attempt to pull a reference which resolves to an OCI artifact (Helm chart for example), results in a bit unrelated error message `invalid rootfs in image configuration`. This provides a more meaningful error in case a user attempts to download a media type which isn't image related. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* distribution: un-export internal errors and error-utilitiesSebastiaan van Stijn2022-04-211-20/+7
| | | | | | | | | | un-exports errors that were only used internally: - Remove ErrNoSupport as it was not emitted anywhere - ImageConfigPullError -> imageConfigPullError - TranslatePullError() -> translatePullError() Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Remove more of registry v1 code.Tibor Vass2021-02-231-14/+1
| | | | | Signed-off-by: Tibor Vass <tibor@docker.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Add fallback for pull by tagBrian Goff2020-12-041-0/+17
| | | | | | | | | | | | | | | Some registries seem to be non-conformant and return a not found error when pulling by digest (which docker now does all the time). To work around this, fallback when all of the following are true: 1. Image reference is a tag 2. Tag->digest resolution succeeds 3. Fetch by resolved digest fails with a "not found" error. This is intentionally not caching the manifests to reduce complexity for this edge case. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* goimports: fix importsSebastiaan van Stijn2019-09-181-1/+1
| | | | | | | Format the source according to latest goimports. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Include original error when translating distribution errorsSebastiaan van Stijn2018-08-031-3/+4
| | | | | | | | | | | | | | | | | | | | Before: curl -v -X POST --unix-socket /var/run/docker.sock "http://localhost/images/create?fromImage=library/busybox:lsfkjsdflkjsdf" {"message":"manifest for busybox:lsfkjsdflkjsdf not found"} curl -v -X POST --unix-socket /var/run/docker.sock "http://localhost/images/create?fromImage=library/nosuchimage:latest" {"message":"pull access denied for nosuchimage, repository does not exist or may require 'docker login'"} After: curl -v -X POST --unix-socket /var/run/docker.sock "http://localhost/images/create?fromImage=library/busybox:lsfkjsdflkjsdf" {"message":"manifest for busybox:lsfkjsdflkjsdf not found: manifest unknown: manifest unknown"} curl -v -X POST --unix-socket /var/run/docker.sock "http://localhost/images/create?fromImage=library/nosuchimage:latest" {"message":"pull access denied for nosuchimage, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"} Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Add canonical import commentDaniel Nephin2018-02-051-1/+1
| | | | Signed-off-by: Daniel Nephin <dnephin@docker.com>
* Move api/errdefs to errdefsBrian Goff2018-01-111-1/+1
| | | | Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Add helpers to create errdef errorsBrian Goff2018-01-111-15/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of having to create a bunch of custom error types that are doing nothing but wrapping another error in sub-packages, use a common helper to create errors of the requested type. e.g. instead of re-implementing this over and over: ```go type notFoundError struct { cause error } func(e notFoundError) Error() string { return e.cause.Error() } func(e notFoundError) NotFound() {} func(e notFoundError) Cause() error { return e.cause } ``` Packages can instead just do: ``` errdefs.NotFound(err) ``` Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Disambiguate mirror -> other endpoint fallbacks from V2 -> V1Jake Sanders2017-11-301-5/+9
| | | | Signed-off-by: Jake Sanders <jsand@google.com>
* Remove string checking in API error handlingBrian Goff2017-08-151-14/+70
| | | | | | | | | | | | | | Use strongly typed errors to set HTTP status codes. Error interfaces are defined in the api/errors package and errors returned from controllers are checked against these interfaces. Errors can be wraeped in a pkg/errors.Causer, as long as somewhere in the line of causes one of the interfaces is implemented. The special error interfaces take precedence over Causer, meaning if both Causer and one of the new error interfaces are implemented, the Causer is not traversed. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
* Update logrus to v1.0.1Derek McGowan2017-07-311-1/+1
| | | | | | Fixes case sensitivity issue Signed-off-by: Derek McGowan <derek@mcgstyle.net>
* [project] change syscall to /x/sys/unix|windowsChristopher Jones2017-07-111-1/+1
| | | | | | | | | | | | | | | | 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 https://github.com/golang/sys/commit/33267e036fd93fcd26ea95b7bdaf2d8306cb743c 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>
* Suggest login on pull denialAlfred Landrum2017-06-091-1/+1
| | | | Signed-off-by: Alfred Landrum <alfred.landrum@docker.com>
* Use distribution referenceDerek McGowan2017-02-071-4/+4
| | | | | | | | | | | | Remove forked reference package. Use normalized named values everywhere and familiar functions to convert back to familiar strings for UX and storage compatibility. Enforce that the source repository in the distribution metadata is always a normalized string, ignore invalid values which are not. Update distribution tests to use normalized values. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
* Merge pull request #28459 from dmcgowan/plugin-repository-pinningVictor Vieux2016-12-081-4/+8
|\ | | | | Plugin repository pinning
| * Add class to repository scopeDerek McGowan2016-11-211-4/+8
| | | | | | | | | | | | Expose registry error translation for plugin distribution Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
* | Stop retrying pull on UnkownBlob errorDarren Stahl2016-11-291-0/+4
|/ | | | Signed-off-by: Darren Stahl <darst@microsoft.com>
* Update pull error handlingDerek McGowan2016-11-101-0/+34
| | | | | | | Translate pull errors to provide a more consistent and user friendly error message. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
* swarm/controller: allow cancellation to propagateStephen J Day2016-07-251-1/+5
| | | | | | | | Ensure that cancellation of a pull propagates rather than continuing to container creation. This ensures that the `Prepare` method is properly re-entrant. Signed-off-by: Stephen J Day <stephen.day@docker.com>
* Don't retry push on an unknown repositoryAaron Lehmann2016-07-111-1/+1
| | | | | | | | | If the remote registry responds with a NAME_UNKNOWN error, treat this as a fatal error and don't retry the push. Tested against an ECR registry. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
* distribution: errors: do not retry on too many requests from registryAntonio Murdaca2016-05-041-1/+1
| | | | Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* distribution: errors: do not retry if no token in responseAntonio Murdaca2016-03-191-1/+2
| | | | Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* distribution: errors: do not access the errors slice if it's emptyAntonio Murdaca2016-03-161-1/+3
| | | | | | | | - 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>
* distribution: errors: do not retry if no credentials providedAntonio Murdaca2016-03-121-0/+4
| | | | | | Fix and add test for case c) in #21054 Signed-off-by: Antonio Murdaca <runcom@redhat.com>
* Smarter push/pull TLS fallbackAaron Lehmann2016-02-121-0/+4
| | | | | | | | | | | | | | | | | | | | 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>
* Push/pull errors improvement and cleanupAaron Lehmann2016-02-111-0/+102
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>