Commit graph

3464 commits

Author SHA1 Message Date
Sebastiaan van Stijn
e444ac3470
api: swagger: move Volume examples inline
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-05 21:39:00 +01:00
Sebastiaan van Stijn
3c6c9fa180
Merge pull request #43300 from thaJeztah/api_update_imageinspect_docs
API: improve swagger and go-doc for ImageInspect structs
2022-03-05 17:54:37 +01:00
Sebastiaan van Stijn
34c2c14775
api: improve godoc for ImageInspect struct
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-03 22:55:34 +01:00
Sebastiaan van Stijn
697f42582a
api: docs: fix warning about comment indentation (current API version)
5428:7    warning  comment not indented like content  (comments-indentation)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-03 22:50:17 +01:00
Sebastiaan van Stijn
3193d7e101
api: docs: update docs for /images/{name}/json (current API version)
- rename definition in swagger from `Image` to `ImageInspect` to match the go type
- improve (or add) documentation for various fields
- move example values in-line in the "definitions" section
- remove the `required` fields from `ImageInspect`, as the type is only used as
  response type (not to make requests).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-03 22:50:10 +01:00
Cory Snider
90c54320c8 daemon/logger: fix data race in LogFile
The log message's timestamp was being read after it was returned to the
pool. By coincidence the timestamp field happened to not be zeroed on
reset so much of the time things would work as expected. But if the
message value was to be taken back out of the pool before WriteLogEntry
returned, the timestamp recorded in the gzip header of compressed
rotated log files would be incorrect.

Make future use-after-put bugs fail fast by zeroing all fields of the
Message value, including the timestamp, when it is put into the pool.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2022-03-03 14:56:25 -05:00
Sebastiaan van Stijn
36ec581e5c
Merge pull request #43277 from thaJeztah/fix_kernelmem_docs_and_error
api: add missing docs for KernelMemoryTCP, and fix error message
2022-03-03 19:33:49 +01:00
Sebastiaan van Stijn
203d97df59
api/swagger.yml: add KernelMemoryTCP to /info endpoint
While this feature is deprecated / unsupported on cgroups v2, it's
part of the API, so let's at least document it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-22 10:25:43 +01:00
Sebastiaan van Stijn
737e8c6ab8
api: POST /containers/{id}/wait: validate "condition" parameter
The endpoint was silently ignoring invalid values for the "condition" parameter.
This patch now returns a 400 status if an unknown, non-empty "condition" is passed.

With this patch:

    curl --unix-socket /var/run/docker.sock -XPOST 'http://localhost/v1.41/containers/foo/wait?condition=foobar'
    {"message":"invalid condition: \"foobar\""}

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-14 21:47:55 +01:00
Sebastiaan van Stijn
0e5929f99d
api/swagger: add missing 400 response for POST /containers/{id}/wait
The /containers/{id}/wait can return a 400 (invalid argument) error if
httputils.ParseForm() fails.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-14 21:46:44 +01:00
Sebastiaan van Stijn
0ac746fabb
api/swagger: update /containers/{id}/wait "condition" parameter to match code
This patch updates the swagger, and:

- adds an enum definition to document valid values (instead of describing them)
- updates the description to mention both "omitted" and "empty" values (although
  the former is already implicitly covered by the field being "optional" and
  having a default value).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-02-14 21:45:58 +01:00
Sebastiaan van Stijn
01ae9525dd
Add support for platform (os and architecture) on image import
Commit 0380fbff37 added the ability to pass a
--platform flag on `docker import` when importing an archive. The intent
of that commit was to allow importing a Linux rootfs on a Windows daemon
(as part of the experimental LCOW feature).

A later commit (337ba71fc1) changed some
of this code to take both OS and Architecture into account (for `docker build`
and `docker pull`), but did not yet update the `docker image import`.

This patch updates the import endpoitn to allow passing both OS and
Architecture. Note that currently only matching OSes are accepted,
and an error will be produced when (e.g.) specifying `linux` on Windows
and vice-versa.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-24 18:24:51 +01:00
Sebastiaan van Stijn
9839ddd800
api: postImagesCreate(): use local variable for platform
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-24 17:00:55 +01:00
Sebastiaan van Stijn
81ac487d71
api: postImagesCreate(): rename ambiguous err variable
This error is meant to be used in the output stream, and some comments
were added to prevent accidentally using local variables.

Renaming the variable instead to make it less ambiguous.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-24 17:00:53 +01:00
Sebastiaan van Stijn
75a1ad0c9f
api: remove HostConfig.LxcConf field
Commit 3b5fac462d  / docker 1.10 removed support
for the LXC runtime, and removed the corresponding fields from the API (v1.22).

This patch removes the `HostConfig.LxcConf` field from the swagger definition.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-20 17:23:51 +01:00
Thomas LEDOS
834272f978
Added error codes for exec resize in API docs
Signed-off-by: Thomas LEDOS <thomas.ledos92@gmail.com>
2022-01-05 10:11:29 +01:00
Thomas LEDOS
1a933e113d
Fixed exec resize success code in API docs
Signed-off-by: Thomas LEDOS <thomas.ledos92@gmail.com>
2022-01-05 10:10:37 +01:00
Sebastiaan van Stijn
25381123d3
Makefile: update bfirsh/redoc to 1.14.0, and fix swagger warnings
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-09-24 17:23:55 +02:00
Sebastiaan van Stijn
1de1d26eda
api/swagger: move DistributionInspect to definitions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-09-02 21:13:22 +02:00
Sebastiaan van Stijn
9c0ca67e95
api/swagger: rename PluginPrivilegeItem to PluginPrivilege
To match the name in Go

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-09-02 21:06:47 +02:00
Sebastiaan van Stijn
a207eea6a4
api/swagger: fix up event-types and move to definitions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-09-02 21:06:44 +02:00
Akihiro Suda
0cd1bd42b4
Merge pull request #42770 from thaJeztah/eventtype_enums
api/types/events: add "Type" type for event-type enum
2021-08-28 00:23:56 +09:00
Akihiro Suda
9e7bbdb9ba
Merge pull request #40084 from thaJeztah/hostconfig_const_cleanup
api/types: hostconfig: add some constants/enums and minor code cleanup
2021-08-28 00:21:31 +09:00
Sebastiaan van Stijn
686be57d0a
Update to Go 1.17.0, and gofmt with Go 1.17
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-24 23:33:27 +02:00
Sebastiaan van Stijn
247f4796d2
api/types/events: add "Type" type for event-type enum
Currently just an alias for string, but we can change it to be  an
actual type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-23 21:14:55 +02:00
Sebastiaan van Stijn
2740726ce1
Merge pull request #42773 from thaJeztah/simplify_version_compare
api/types/versions: simplify compare if versions are equal
2021-08-23 19:37:29 +02:00
Sebastiaan van Stijn
96e4adfdc2
api/types/versions: simplify compare if versions are equal
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-22 11:05:22 +02:00
Tobias Gesellchen
8f75d8d4d5 Fix swagger docs to match the opencontainers image-spec
Signed-off-by: Tobias Gesellchen <tobias@gesellix.de>
2021-08-19 21:10:12 +02:00
Tobias Gesellchen
ef44b22085 Extract PluginPrivilegeItem as explicit type definition
Signed-off-by: Tobias Gesellchen <tobias@gesellix.de>
2021-08-19 21:10:12 +02:00
Tobias Gesellchen
52a9f1689a Use explicit object names for improved swagger based code generation
Signed-off-by: Tobias Gesellchen <tobias@gesellix.de>
2021-08-19 21:10:12 +02:00
Tobias Gesellchen
9275268110 Fix ContainerSummary swagger docs
Signed-off-by: Tobias Gesellchen <tobias@gesellix.de>
2021-08-19 21:10:12 +02:00
Tobias Gesellchen
6b53f2c5a2 Add "changes" query parameter for /image/create to swagger docs
Signed-off-by: Tobias Gesellchen <tobias@gesellix.de>
2021-08-19 21:10:12 +02:00
Tobias Gesellchen
d741c14f1f Add RestartPolicy "no" to swagger docs
Signed-off-by: Tobias Gesellchen <tobias@gesellix.de>
2021-08-19 20:33:04 +02:00
Roman Volosatovs
0fdd23b7fe
API: discard /system/df type parameter pre-1.42
The parameter is introduced in API version 1.42

Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
2021-08-06 19:33:16 +02:00
Sebastiaan van Stijn
6948ab4fa1
api/types: hostconfig: fix LogMode enum
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-06 19:05:58 +02:00
Sebastiaan van Stijn
5ae1c1f4cf
api/types: hostconfig: clean up enum for Isolation
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-06 19:05:56 +02:00
Sebastiaan van Stijn
09cf117b31
api/types: hostconfig: create enum for CgroupnsMode
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-06 19:05:54 +02:00
Sebastiaan van Stijn
98f0f0dd87
api/types: hostconfig: define consts for IpcMode
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-06 19:05:51 +02:00
Roman Volosatovs
47ad2f3dd6
API,daemon: support type URL parameter to /system/df
Let clients choose object types to compute disk usage of.

Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-27 12:17:45 +02:00
Sebastiaan van Stijn
28409ca6c7
replace pkg/signal with moby/sys/signal v0.5.0
This code was moved to the moby/sys repository

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-23 09:32:54 +02:00
Justin Cormack
b337c70bdc
Merge pull request #42639 from thaJeztah/system_info_clean
pkg/sysinfo: assorted cleanup/refactoring for handling warnings and logging
2021-07-19 15:17:07 +01:00
Sebastiaan van Stijn
7d63cbfd38
api/types: add GoDoc to Info.Warnings field
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-14 23:10:16 +02:00
Roman Volosatovs
2af9bd3b26
API: add shared-size parameter to image queries
The reasoning for this change is to be able to query image shared size without having to rely on the more heavyweight `/system/df` endpoint.

Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
2021-07-13 13:46:07 +02:00
Roman Volosatovs
bf9c76f0a8
API, daemon/images: add ImageListOptions and pass context
This makes it easier to add more options to the backend without having to change
the signature.

While we're changing the signature, also adding a context.Context, which is not
currently used, but probably should be at some point.

Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
2021-07-13 13:45:24 +02:00
Roman Volosatovs
31348afa19
API: deprecate BuilderSize in API versions >= 1.42
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
2021-07-12 10:03:49 +02:00
Roman Volosatovs
83e3dd68ca
swagger: add BuildCache example to /system/df
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
2021-07-09 09:57:13 +02:00
Roman Volosatovs
f2225933bb
API: ensure empty build cache is represented as empty JSON array
Ensure empty `BuildCache` field is represented as empty JSON array(`[]`)
instead of `null` to be consistent with `Images`, `Containers` etc.

Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
2021-07-08 13:13:46 +02:00
Sebastiaan van Stijn
c858e496f6
Merge pull request #42596 from thaJeztah/sync_swagger_fix
API: fix 404 status description on container create
2021-07-07 11:49:10 +02:00
Sebastiaan van Stijn
68b095d4df
API: fix 404 status description on container create
This updates the current swagger file, and all docs versions
with the same fix as ff1d9a3ec5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-03 21:30:47 +02:00
Sebastiaan van Stijn
477244cca5
API: update API version to v1.42
Docker 20.10 was released with API v1.41, so any change in the API
should now target v1.42.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-03 18:12:46 +02:00