summaryrefslogtreecommitdiff
path: root/api/server
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* | | plugin: use types/registry.AuthConfigSebastiaan van Stijn2022-07-291-0/+1
| | | | | | | | | | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | | api/server/router: use types/registry.AuthConfigSebastiaan van Stijn2022-07-299-32/+34
| | | | | | | | | | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | | api: add const for 'X-Registry-Auth'Sebastiaan van Stijn2022-07-295-10/+13
|/ / | | | | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | gofmt filesSebastiaan van Stijn2022-07-081-16/+16
| | | | | | | | | | | | | | | | result of: gofmt -s -w $(find . -type f -name '*.go' | grep -v "/vendor/") Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | api: add Hosts to API ConfigSebastiaan van Stijn2022-06-291-0/+2
| | | | | | | | | | | | This makes the API configuration more self-contained. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | api: POST /containers/{id}/wait: fix validation for "condition" parameterSebastiaan van Stijn2022-06-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 737e8c6ab81842d61d86df3efec5f505b5484d4c added validation for the wait condition parameter, however, the default ("not-running") option was not part of the list of valid options, resulting in a regression if the default value was explicitly passed; docker scan --accept-license --version Error response from daemon: invalid condition: "not-running" This patch adds the missing option, and adds a test to verify. With this patch; make BIND_DIR=. DOCKER_GRAPHDRIVER=vfs TEST_FILTER=TestWaitConditions test-integration ... --- PASS: TestWaitConditions (0.04s) --- PASS: TestWaitConditions/removed (1.79s) --- PASS: TestWaitConditions/default (1.91s) --- PASS: TestWaitConditions/next-exit (1.97s) --- PASS: TestWaitConditions/not-running (1.99s) PASS Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | container/exec: Support ConsoleSizePaweł Gronowski2022-06-242-2/+28
| | | | | | | | | | | | | | | | | | Now client have the possibility to set the console size of the executed process immediately at the creation. This makes a difference for example when executing commands that output some kind of text user interface which is bounded by the console dimensions. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* | Move the inspect code away from the image serviceDjordje Lukic2022-06-223-6/+106
|/ | | | | | | | | The LoopkupImage method is only used by the inspect image route and returns an api/type struct. The depenency to api/types of the daemon/images package is wrong, the daemon doesn't need to know about the api types. Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
* introduce CreateMountpoint for parity between binds and mountsNicolas De Loof2022-05-191-0/+34
| | | | Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
* daemon/linux: Set console size on creationPaweł Gronowski2022-05-191-0/+6
| | | | | | | | | | | | On Linux the daemon was not respecting the HostConfig.ConsoleSize property and relied on cli initializing the tty size after the container was created. This caused a delay between container creation and the tty actually being resized. This is also a small change to the api description, because HostConfig.ConsoleSize is no longer Windows-only. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* wsContainersAttach attach to stdin/out/err streams as requestedNicolas De Loof2022-05-171-4/+11
| | | | Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
* Add Swarm cluster volume supportsDrew Erny2022-05-134-5/+883
| | | | | | Adds code to support Cluster Volumes in Swarm using CSI drivers. Signed-off-by: Drew Erny <derny@mirantis.com>
* Make it explicit raw|multiplexed stream implementation being usedNicolas De Loof2022-05-123-11/+29
| | | | | | fix #35761 Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
* api/server: fix stray import in container_routes.goSebastiaan van Stijn2022-05-061-1/+0
| | | | | | | This import was left behind due to some PR's being merged, both affecting the imports that were used. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #43552 from thaJeztah/remove_redundant_validationSebastiaan van Stijn2022-05-061-12/+2
|\ | | | | api: postContainersStop, postContainersRestart remove redundant validation
| * api: postContainersStop, postContainersRestart remove redundant validationSebastiaan van Stijn2022-05-021-12/+2
| | | | | | | | | | | | | | Both of these pass the signal to daemon.containerStop(), which already validates the signal; https://github.com/moby/moby/blob/2ed904cad7055847796433cc56ef1d1de0da868c/daemon/stop.go#L48-L52 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | daemon: daemon.ContainerKill() accept stop-signal as stringSebastiaan van Stijn2022-05-052-13/+2
|/ | | | | | | | | This allows the postContainersKill() handler to pass values as-is. As part of the rewrite, I also moved the daemon.GetContainer(name) call later in the function, so that we can fail early if an invalid signal is passed, before doing the (heavier) fetching of the container. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* update uses of container.ContainerCreateCreatedBody to CreateResponseSebastiaan van Stijn2022-04-281-1/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api: rename volume.VolumeCreateBody to volume.CreateOptionsSebastiaan van Stijn2022-04-281-1/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api: rename volume.VolumeListOKBody to volume.ListResponseSebastiaan van Stijn2022-04-281-1/+1
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* imports: remove "volumetypes" aliases for api/types/volumeSebastiaan van Stijn2022-04-281-6/+6
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* api: rename ContainerWaitOKBody to container.WaitResponseSebastiaan van Stijn2022-04-281-3/+3
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #43332 from thaJeztah/api_swagger_move_definitionsSebastiaan van Stijn2022-04-261-3/+4
|\ | | | | api: swagger: use explicit definitions for some response types, and move examples per-field
| * api/types: replace uses of deprecated types.Volume with volume.VolumeSebastiaan van Stijn2022-04-211-3/+4
| | | | | | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | api/server: remove "Logging" from configSebastiaan van Stijn2022-04-232-2/+1
|/ | | | | | | | | | | | | | | | | | | | | | | The Logging boolean was unconditionally set to true and ignored in all locations, except for enabling the debugging middleware, which was also gated by the active logrus logging level. While it could make sense to have a Loglevel option configured on the API server, we don't have this currently, and to make that actually useful, that config would need to be tollerated by all locations that produce logs (which isn't the case either). Looking at the history of this option; a boolean to disable logging was originally added in commit c423a790d629b13c2eb1bc553beb3f61e30b3888, which hard-coded it to "disabled" in a test, and "enabled" for the API server outside of tests (before that commit, logging was always enabled). 02ddaad5d985186eed94dea4105a57fa21ba24db and 5c42b2b5122c1db08d229c258da26869b4d4d9cc changed the hard-coded values to be configurable through a `Logging` env-var (env- vars were used _internally_ at the time to pass on options), which later became a configuration struct in a0bf80fe0372196812a9cb295f209c08f8037601. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* API: add "signal" parameter to container stop and restart endpointsSebastiaan van Stijn2022-04-201-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Containers can have a default stop-signal (`--stop-signal` / `STOPSIGNAL`) and timeout (`--stop-timeout`). It is currently not possible to update either of these after the container is created (`docker update` does not allow updating them), and while either of these can be overridden through some commands, we currently do not have a command that can override *both*: command | stop-signal | stop-timeout | notes ----------------|-------------|--------------|---------------------------- docker kill | yes | DNA | only sends a single signal docker restart | no | yes | docker stop | no | yes | As a result, if a user wants to stop a container with a custom signal and timeout, the only option is to do this manually: docker kill -s <custom signal> mycontainer # wait <desired timeout> # press ^C to cancel the graceful stop # forcibly kill the container docker kill mycontainer This patch adds a new `signal` query parameter to the container "stop" and "restart" endpoints. This parameter can be added as a new flag on the CLI, which would allow stopping and restarting with a custom timeout and signal, for example: docker stop --signal=SIGWINCH --time=120 mycontainer docker restart --signal=SIGWINCH --time=120 mycontainer Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* backend: add StopOptions to ContainerRestart and ContainerStopSebastiaan van Stijn2022-04-202-8/+8
| | | | | | While we're modifying the interface, also add a context to both. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #43471 from thaJeztah/grpc_nitBrian Goff2022-04-201-10/+10
|\ | | | | api/server/router/grpc: fix some nits in NewRouter()
| * api/server/router/grpc: fix some nits in NewRouter()Sebastiaan van Stijn2022-04-071-10/+10
| | | | | | | | | | | | | | | | | | | | | | These were changes I drafted when reviewing 7c731e02a980666e262c68d4995f5643b6ffae30, and had these stashed in my local git; - rename receiver to prevent "unconsistent receiver name" warnings - make NewRouter() slightly more idiomatic, and wrap the options, to make them easier to read. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | api/server/httputils: move WriteJSON() together with ReadJSON()Sebastiaan van Stijn2022-04-112-15/+9
| | | | | | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | api/server/httputils: add ReadJSON() utilitySebastiaan van Stijn2022-04-1111-162/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a ReadJSON() utility to help reduce some code-duplication, and to make sure we handle JSON requests consistently (e.g. always check for the content-type). Differences compared to current handling: - prevent possible panic if request.Body is nil ("should never happen") - always require Content-Type to be "application/json" - be stricter about additional content after JSON (previously ignored) - but, allow the body to be empty (an empty body is not invalid); update TestContainerInvalidJSON accordingly, which was testing the wrong expectation. - close body after reading (some code did this) We should consider to add a "max body size" on this function, similar to https://github.com/moby/moby/blob/7b9275c0da707b030e62c96b679a976f31f929d3/api/server/middleware/debug.go#L27-L40 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | api/server/httputils: matchesContentType(): return error instead of loggingSebastiaan van Stijn2022-04-112-18/+25
|/ | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* API: add "Swarm" header to _ping endpointSebastiaan van Stijn2022-03-252-0/+18
| | | | | | | | | | | | This adds an additional "Swarm" header to the _ping endpoint response, which allows a client to detect if Swarm is enabled on the daemon, without having to call additional endpoints. This change is not versioned in the API, and will be returned irregardless of the API version that is used. Clients should fall back to using other endpoints to get this information if the header is not present. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* errdefs: move GetHTTPErrorStatusCode to api/server/httpstatusSebastiaan van Stijn2022-03-216-40/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts the changes made in 2a9c987e5a72549775ffa4dc31595ceff4f06a78, which moved the GetHTTPErrorStatusCode() utility to the errdefs package. While it seemed to make sense at the time to have the errdefs package provide conversion both from HTTP status codes errdefs and the reverse, a side-effect of the move was that the errdefs package now had a dependency on various external modules, to handle conversio of errors coming from those sub-systems, such as; - github.com/containerd/containerd - github.com/docker/distribution - google.golang.org/grpc This patch moves the conversion from (errdef-) errors to HTTP status-codes to a api/server/httpstatus package, which is only used by the API server, and should not be needed by client-code using the errdefs package. The MakeErrorHandler() utility was moved to the API server itself, as that's the only place it's used. While the same applies to the GetHTTPErrorStatusCode func, I opted for keeping that in its own package for a slightly cleaner interface. Why not move it into the api/server/httputils package? The api/server/httputils package is also imported in the client package, which uses the httputils.ParseForm() and httputils.HijackConnection() functions as part of the TestTLSCloseWriter() test. While this is only used in tests, I wanted to avoid introducing the indirect depdencencies outside of the api/server code. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* search: remove parsing JSON filters out of the backendSebastiaan van Stijn2022-03-182-2/+7
| | | | | | | | All other endpoints handle this in the API; given that the JSON format for filters is part of the API, it makes sense to handle it there, and not have that concept leak into further down the code. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>