summaryrefslogtreecommitdiff
path: root/api/server/router
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #45469 from thaJeztah/deprecate_virtualsize_STEP2Akihiro Suda2023-05-162-1/+13
|\ | | | | API: omit deprecated VirtualSize field for API v1.44 and up
| * API: omit deprecated VirtualSize field for API v1.44 and upSebastiaan van Stijn2023-05-062-1/+13
| | | | | | | | | | | | | | | | This field is deprecated since 1261fe69a3586bb102182aa885197822419c768c, and will now be omitted on API v1.44 and up for the `GET /images/json`, `GET /images/{id}/json`, and `GET /system/df` endpoints. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | fixing consistent aliases for OCI spec importsJeyanthinath Muthuram2023-05-084-12/+12
|/ | | | Signed-off-by: Jeyanthinath Muthuram <jeyanthinath10@gmail.com>
* api/server/router/container: containerRouter.postCommit: inline structSebastiaan van Stijn2023-04-291-4/+2
| | | | | | Remove intermediate variable and inline the struct-literal. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* API: deprecate VirtualSize field for /images/json and /images/{id}/jsonSebastiaan van Stijn2023-04-181-1/+1
| | | | | | | | | In versions of Docker before v1.10, this field was calculated from the image itself and all of its parent images. Images are now stored self-contained, and no longer use a parent-chain, making this field an equivalent of the Size field. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api/server: getImagesJSON(): don't check version in a loopSebastiaan van Stijn2023-04-171-1/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #44963 from vvoland/c8d-push-upstreamTianon Gravi2023-03-302-2/+20
|\ | | | | c8d: Implement push
| * images/push: Accept referencePaweł Gronowski2023-03-302-2/+20
| | | | | | | | | | | | | | Push the reference parsing from repo and tag names into the api and pass a reference object to the ImageService. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* | c8d: add support for `docker diff`Laura Brehm2023-03-302-2/+2
|/ | | | Signed-off-by: Laura Brehm <laurabrehm@hey.com>
* registry/search: pass User-Agent through headersSebastiaan van Stijn2023-03-212-8/+11
| | | | | | | | | | | | | | | | | | Commit 3991faf4640a46412a8af000ede78fc5cba76d0a moved search into the registry package, which also made the `dockerversion` package a dependency for registry, which brings additional (indirect) dependencies, such as `pkg/parsers/kernel`, and `golang.org/x/sys/windows/registry`. Client code, such as used in docker/cli may depend on the `registry` package, but should not depend on those additional dependencies. This patch moves setting the userAgent to the API router, and instead of passing it as a separate argument, includes it into the "headers". As these headers now not only contain the `X-Meta-...` headers, the variables were renamed accordingly. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #45086 from corhere/search-in-registry-serviceBjorn Neergaard2023-03-153-4/+9
|\ | | | | Move filtered registry search out of the image service
| * Move filtered registry search out of image serviceCory Snider2023-03-103-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SearchRegistryForImages does not make sense as part of the image service interface. The implementation just wraps the search API of the registry service to filter the results client-side. It has nothing to do with local image storage, and the implementation of search does not need to change when changing which backend (graph driver vs. containerd snapshotter) is used for local image storage. Filtering of the search results is an implementation detail: the consumer of the results does not care which actor does the filtering so long as the results are filtered as requested. Move filtering into the exported API of the registry service to hide the implementation details. Only one thing---the registry service implementation---would need to change in order to support server-side filtering of search results if Docker Hub or other registry servers were to add support for it to their APIs. Use a fake registry server in the search unit tests to avoid having to mock out the registry API client. Signed-off-by: Cory Snider <csnider@mirantis.com>
* | volumes: fix error-handling when removing volumes with swarm enabledSebastiaan van Stijn2023-03-131-14/+18
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 3246db3755698455740c812c6477f43e74924fa7 added handling for removing cluster volumes, but in some conditions, this resulted in errors not being returned if the volume was in use; docker swarm init docker volume create foo docker create -v foo:/foo busybox top docker volume rm foo This patch changes the logic for ignoring "local" volume errors if swarm is enabled (and cluster volumes supported). While working on this fix, I also discovered that Cluster.RemoveVolume() did not handle the "force" option correctly; while swarm correctly handled these, the cluster backend performs a lookup of the volume first (to obtain its ID), which would fail if the volume didn't exist. Before this patch: make TEST_FILTER=TestVolumesRemoveSwarmEnabled DOCKER_GRAPHDRIVER=vfs test-integration ... Running /go/src/github.com/docker/docker/integration/volume (arm64.integration.volume) flags=-test.v -test.timeout=10m -test.run TestVolumesRemoveSwarmEnabled ... === RUN TestVolumesRemoveSwarmEnabled === PAUSE TestVolumesRemoveSwarmEnabled === CONT TestVolumesRemoveSwarmEnabled === RUN TestVolumesRemoveSwarmEnabled/volume_in_use volume_test.go:122: assertion failed: error is nil, not errdefs.IsConflict volume_test.go:123: assertion failed: expected an error, got nil === RUN TestVolumesRemoveSwarmEnabled/volume_not_in_use === RUN TestVolumesRemoveSwarmEnabled/non-existing_volume === RUN TestVolumesRemoveSwarmEnabled/non-existing_volume_force volume_test.go:143: assertion failed: error is not nil: Error response from daemon: volume no_such_volume not found --- FAIL: TestVolumesRemoveSwarmEnabled (1.57s) --- FAIL: TestVolumesRemoveSwarmEnabled/volume_in_use (0.00s) --- PASS: TestVolumesRemoveSwarmEnabled/volume_not_in_use (0.01s) --- PASS: TestVolumesRemoveSwarmEnabled/non-existing_volume (0.00s) --- FAIL: TestVolumesRemoveSwarmEnabled/non-existing_volume_force (0.00s) FAIL With this patch: make TEST_FILTER=TestVolumesRemoveSwarmEnabled DOCKER_GRAPHDRIVER=vfs test-integration ... Running /go/src/github.com/docker/docker/integration/volume (arm64.integration.volume) flags=-test.v -test.timeout=10m -test.run TestVolumesRemoveSwarmEnabled ... make TEST_FILTER=TestVolumesRemoveSwarmEnabled DOCKER_GRAPHDRIVER=vfs test-integration ... Running /go/src/github.com/docker/docker/integration/volume (arm64.integration.volume) flags=-test.v -test.timeout=10m -test.run TestVolumesRemoveSwarmEnabled ... === RUN TestVolumesRemoveSwarmEnabled === PAUSE TestVolumesRemoveSwarmEnabled === CONT TestVolumesRemoveSwarmEnabled === RUN TestVolumesRemoveSwarmEnabled/volume_in_use === RUN TestVolumesRemoveSwarmEnabled/volume_not_in_use === RUN TestVolumesRemoveSwarmEnabled/non-existing_volume === RUN TestVolumesRemoveSwarmEnabled/non-existing_volume_force --- PASS: TestVolumesRemoveSwarmEnabled (1.53s) --- PASS: TestVolumesRemoveSwarmEnabled/volume_in_use (0.00s) --- PASS: TestVolumesRemoveSwarmEnabled/volume_not_in_use (0.01s) --- PASS: TestVolumesRemoveSwarmEnabled/non-existing_volume (0.00s) --- PASS: TestVolumesRemoveSwarmEnabled/non-existing_volume_force (0.00s) PASS Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* remove GetLayerByID from ImageService interfaceNicolas De Loof2023-03-102-2/+2
| | | | | | Co-authored-by: Nicolas De Loof <nicolas.deloof@gmail.com> Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* c8d: Compute container's layer sizeLaura Brehm2023-03-082-2/+2
| | | | | Co-authored-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: Laura Brehm <laurabrehm@hey.com>
* api: Remove <none> in Repo(Tags|Digests) for >= 1.43Paweł Gronowski2023-02-271-3/+12
| | | | | | | | | Deprecate `<none>:<none>` and `<none>@<none>` magic strings included in `RepoTags` and `RepoDigests`. Produce an empty arrays instead and leave the presentation of untagged/dangling images up to the client. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* Merge pull request #45025 from corhere/oci-annotation-passthruBrian Goff2023-02-241-0/+5
|\
| * daemon: add annotations to container HostConfigCory Snider2023-02-231-0/+5
| | | | | | | | | | | | | | Allow clients to set annotations on a container which will applied to the container's OCI spec. Signed-off-by: Cory Snider <csnider@mirantis.com>
* | api: Move Repo(Digests|Tags) <none> fallback from daemonPaweł Gronowski2023-02-221-0/+7
|/ | | | Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* api/s/r/swarm: log backend errors at Debug levelCory Snider2023-02-151-16/+40
| | | | | | | | | | | | | | The errors are already returned to the client in the API response, so logging them to the daemon log is redundant. Log the errors at level Debug so as not to pollute the end-users' daemon logs with noise. Refactor the logs to use structured fields. Add the request context to the log entry so that logrus hooks could annotate the log entries with contextual information about the API request in the hypothetical future. Fixes #44997 Signed-off-by: Cory Snider <csnider@mirantis.com>
* api: Extract parsing reference from repo and tagPaweł Gronowski2023-02-072-39/+12
| | | | Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* api/tag: Reject digested target referencesPaweł Gronowski2023-02-071-0/+4
| | | | Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* daemon/imageService: Remove TagImageWithReferencePaweł Gronowski2023-02-072-2/+24
| | | | | | | | TagImage is just a wrapper for TagImageWithReference which parses the repo and tag into a reference. Change TagImageWithReference into TagImage and move the responsibility of reference parsing to caller. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* daemon: Pass ctx to image tagging operationsNicolas De Loof2023-02-072-2/+2
| | | | | Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com> Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* api/import: Guard from Digested instead of Canonical referencePaweł Gronowski2023-01-111-1/+1
| | | | | | | Import shouldn't accept any digested reference, instead of only strictly canonical ones. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* daemon/import: Extract common logic to apiPaweł Gronowski2023-01-112-3/+62
| | | | | | | Extract logic that would need to be duplicated in both implementations of ImageService. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* add support for image inspect with containerd-integrationNicolas De Loof2023-01-051-2/+1
| | | | | | | | | | | | | | | | | | | This is a squashed version of various PRs (or related code-changes) to implement image inspect with the containerd-integration; - add support for image inspect - introduce GetImageOpts to manage image inspect data in backend - GetImage to return image tags with details - list images matching digest to discover all tags - Add ExposedPorts and Volumes to the image returned - Refactor resolving/getting images - Return the image ID on inspect - consider digest and ignore tag when both are set - docker run --platform Signed-off-by: Djordje Lukic <djordje.lukic@docker.com> Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* manage image inspect data in backendNicolas De Loof2022-12-091-27/+6
| | | | | | | | This allows differentiating how the detailed data is collected between the containerd-integration code and the existing implementation. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* ImageService.ImageHistory(): pass contextSebastiaan van Stijn2022-12-092-2/+2
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* imageservice: Add context to various methodsNicolas De Loof2022-11-036-12/+12
| | | | | Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com> Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* implement docker system dfNicolas De Loof2022-11-021-1/+1
| | | | Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
* Merge pull request #44224 from dperny/cluster-volumes-updateBrian Goff2022-10-252-7/+20
|\ | | | | Fix force-remove for cluster volumes
| * fix force remove for cluster volumesDrew Erny2022-10-122-7/+20
| | | | | | | | Signed-off-by: Drew Erny <derny@mirantis.com>
* | Volume prune: only prune anonymous volumes by defaultBrian Goff2022-10-041-0/+6
|/ | | | | | | | | | | | | | | This adds a new filter argument to the volume prune endpoint "all". When this is not set, or it is a false-y value, then only anonymous volumes are considered for pruning. When `all` is set to a truth-y value, you get the old behavior. This is an API change, but I think one that is what most people would want. Signed-off-by: Brian Goff <cpuguy83@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api/server: fix empty-lines (revive)Sebastiaan van Stijn2022-09-282-2/+0
| | | | | | | | api/server/router/build/build_routes.go:239:32: empty-lines: extra empty line at the start of a block (revive) api/server/middleware/version.go:45:241: empty-lines: extra empty line at the end of a block (revive) api/server/router/swarm/helpers_test.go:11:44: empty-lines: extra empty line at the end of a block (revive) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* ImageService.GetImage(): pass contextSebastiaan van Stijn2022-09-072-2/+2
| | | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
* Merge pull request #43968 from thaJeztah/implement_GetImageOptsSebastiaan van Stijn2022-08-242-2/+3
|\ | | | | introduce GetImageOpts to manage image inspect data in backend
| * introduce GetImageOpts to manage image inspect data in backendNicolas De Loof2022-08-162-2/+3
| | | | | | | | | | | | | | | | Currently only provides the existing "platform" option, but more options will be added in follow-ups. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | Merge pull request #43657 from thaJeztah/default_builder_versionSebastiaan van Stijn2022-08-181-10/+19
|\ \ | |/ |/| api: set default "Builder-Version" to "2" (BuildKit) on Linux
| * api: set default "Builder-Version" to "2" (BuildKit) on LinuxSebastiaan van Stijn2022-05-291-10/+19
| | | | | | | | | | | | | | | | | | | | | | | | Starting with the 22.06 release, buildx is the default client for docker build, which uses BuildKit as builder. This patch changes the default builder version as advertised by the daemon to "2" (BuildKit), so that pre-22.06 CLIs with BuildKit support (but no buildx installed) also default to using BuildKit when interacting with a 22.06 (or up) daemon. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | Merge pull request #43899 from thaJeztah/fix_build_api_errorsSamuel Karp2022-08-131-18/+16
|\ \
| * | api: api/server/router/build: fix API errorsSebastiaan van Stijn2022-08-021-18/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some error conditions returned a non-typed error, which would be returned as a 500 status by the API. This patch; - Updates such errors to return an errdefs.InvalidParameter type - Introduces a locally defined `invalidParam{}` type for convenience. - Updates some error-strings to match Go conventions Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | | api/server/router/image: address some linter warningsSebastiaan van Stijn2022-08-082-57/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | My IDE was complaining about some things; - fix inconsistent receiver name (i vs s) - fix some variables that collided with imports Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | | Merge pull request #43822 from thaJeztah/image_load_saveSebastiaan van Stijn2022-08-042-4/+4
|\ \ \ | | | | | | | | containerd integration: Implement load/save
| * | | add image load/save supportNicolas De Loof2022-08-042-4/+4
| | | | | | | | | | | | | | | | Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
* | | | api: add BuildCache.Parents for API >= v1.42Sebastiaan van Stijn2022-08-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This field was added to replace the deprecated "Parent" field. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | | | api: deprecate BuildCache.Parent in API >= v1.42Sebastiaan van Stijn2022-08-041-0/+7
|/ / / | | | | | | | | | | | | | | | | | | This field has been deprecated in BuildKit, so this follows the deprecation in the Engine API. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | | Merge pull request #43820 from thaJeztah/image_deleteBrian Goff2022-08-032-2/+2
|\ \ \ | | | | | | | | containerd integration: Implement ImageDelete for containerd
| * | | Implement ImageDelete for containerdDjordje Lukic2022-07-282-2/+2
| |/ / | | | | | | | | | | | | Signed-off-by: Djordje Lukic <djordje.lukic@docker.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | | api: add registry.DecodeAuthConfig, registry.DecodeAuthConfigBodySebastiaan van Stijn2022-07-293-72/+27
| | | | | | | | | | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>