Commit graph

285 commits

Author SHA1 Message Date
Ben Lovy
341e7b35a6 Updated manifest v2 URLs in image spec README
Signed-off-by: Ben Lovy <ben@deciduously.com>
2023-12-28 16:13:26 -05:00
Sebastiaan van Stijn
f05dce8d3a
replace some strings with OCI consts
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-17 16:34:52 +02:00
Sebastiaan van Stijn
cff4f20c44
migrate to github.com/containerd/log v0.1.0
The github.com/containerd/containerd/log package was moved to a separate
module, which will also be used by upcoming (patch) releases of containerd.

This patch moves our own uses of the package to use the new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-11 17:52:23 +02:00
Sebastiaan van Stijn
a3c97beee0
image: implement CheckOS, deprecate pkg/system IsOSSupported
Implement a function that returns an error to replace existing uses of
the IsOSSupported utility, where callers had to produce the error after
checking.

The IsOSSupported function was used in combination with images, so implementing
a utility in "image" to prevent having to import pkg/system (which contains many
unrelated functions)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-07 22:14:44 +02:00
Sebastiaan van Stijn
1148a24e64
migrate to new github.com/distribution/reference module
The "reference" package was moved to a separate module, which was extracted
from b9b19409cf

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-09-05 12:09:26 +02:00
Sebastiaan van Stijn
9c4e82435e
Merge pull request #46351 from thaJeztah/api_events_actions_enum
api/types/events: define "Action" type and consts
2023-09-05 11:11:42 +02:00
Paweł Gronowski
366a5f1d74
image/spec: Add Go structs
Add Go structs describing the image spec which extend the OCI types.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-08-31 12:29:45 +02:00
Sebastiaan van Stijn
e9b3a16cdc
Merge pull request #46381 from vvoland/image-spec-healthcheck-startinterval
image/spec: Add Healthcheck.StartInterval (v1.3)
2023-08-31 12:23:32 +02:00
Paweł Gronowski
536826d66f
image/spec: Add Healthcheck.StartInterval (v1.3)
This field was added in 2216d3ca8d.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-08-31 11:22:54 +02:00
Paweł Gronowski
6dd78a9ac2
image/spec: Fix typo in "superseded"
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-08-31 10:35:14 +02:00
Sebastiaan van Stijn
d864d1eb97
image/spec: add back versioned files
Add back files at the old locations, as there may be external links
referencing the specification.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 16:17:17 +02:00
Sebastiaan van Stijn
7aa0bc5790
merge image-spec v1.2 into specs.md
This merges the v1.2 specs to provide a single history of the
specification.

To view the combined history:

    git log --follow image/spec/spec.md

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 16:11:14 +02:00
Sebastiaan van Stijn
823d0b3765
merge image-spec v1.1 into specs.md
This merges the v1.1 specs to provide a single history of the
specification.

To view the combined history:

    git log --follow image/spec/spec.md
2023-08-30 16:09:30 +02:00
Sebastiaan van Stijn
b8de6c01b5
image/spec: rename v1.2.md to spec.md
In preparation of merging the versioned-specs into a single file,
with history.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 16:06:36 +02:00
Sebastiaan van Stijn
c3f2bd1009
image/spec: rename v1.1.md to spec.md
In preparation of merging the versioned-specs into a single file,
with history.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 16:06:07 +02:00
Sebastiaan van Stijn
7ff38506ab
image/spec: rename v1.0.md to spec.md
In preparation of merging the versioned-specs into a single file,
with history.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 16:05:34 +02:00
Sebastiaan van Stijn
32d5e6312d
image/spec: use permalink to versioned documents
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 16:04:08 +02:00
Sebastiaan van Stijn
7b7019a4da
image/spec: add missing "Shell" field (v1.2)
This field was added in b18ae8c9cc, which
was part of v1.12.0-rc1 and later, which used image spec v1.2.0.

This patch amends the v1.2 spec to include the missing field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 14:33:11 +02:00
Sebastiaan van Stijn
5380f3f0c4
image/spec: add missing "ArgsEscaped" field (v1.1, v1.2)
This field was added in 9db5db1b94, which
was part of v1.10.0-rc1 and later, which used image spec v1.1.0.

It's worth noting that documentation for the v1.1.0 image spec was not
yet available until commit 4fa0eccd10,
which was included in v1.12.0-rc1 and up. The `ArgsEscaped` field was
also adopted by the OCI image spec since [v1.1.0-rc3][1], but considered
deprecated, and not recommended to be used.

This patch amends the v1.1 and v1.2 specifications to describe the field.

[1]: 59780aa569

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 13:25:00 +02:00
Sebastiaan van Stijn
f33370219b
image/spec: add missing "OnBuild" field
This field was added in commit 9f994c9646,
which was merged before the image-spec v1.0.0 was released (which happened
in commit 79910625f0).

This patch backfills the specifications to describe the property.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 13:04:26 +02:00
Sebastiaan van Stijn
e19edd3f25
image/spec: minor fixes and touch-ups in markdown files
- remove some trailing commas, which made the JSON invalid (some of these
  were fixed in the 1.2 spec, but not in older versions).
- synchronise some formatting / phrasing between versions, to make them
  easier to compare.
- remove non-breaking spaces (`NBSP`) in example outputs, and replace
  them with regular spaces.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-30 11:18:20 +02:00
Sebastiaan van Stijn
0f871f8cb7
api/types/events: define "Action" type and consts
Define consts for the Actions we use for events, instead of "ad-hoc" strings.
Having these consts makes it easier to find where specific events are triggered,
makes the events less error-prone, and allows documenting each Action (if needed).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-29 00:38:08 +02:00
Sebastiaan van Stijn
87cedbe443
image: format code with gofumpt
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-24 17:57:22 +02:00
Paweł Gronowski
01214bafd2
c8d/builder: Don't drop fields from created image
Previous image created a new partially filled image.
This caused child images to lose their parent's layers.

Instead of creating a new object and trying to replace its fields, just
clone the original passed image and change its ID to the manifest
digest.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-08-24 09:44:12 +02:00
Sebastiaan van Stijn
5e2a1195d7
swap logrus types for their containerd/logs aliases
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-08-01 13:02:55 +02:00
Brian Goff
74da6a6363 Switch all logging to use containerd log pkg
This unifies our logging and allows us to propagate logging and trace
contexts together.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-06-24 00:23:44 +00:00
Tianon Gravi
2a6ff3c24f Use OCI "History" type instead of inventing our own copy
The most notable change here is that the OCI's type uses a pointer for `Created`, which we probably should've been too, so most of these changes are accounting for that (and embedding our `Equal` implementation in the one single place it was used).

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2023-06-12 13:47:17 -07:00
Brian Goff
1e55ace875 Add oci index and layout files to exported tars
This makes the output of `docker save` fully OCI compliant.

When using the containerd image store, this code is not used. That
exporter will just use containerd's export method and should give us the
output we want for multi-arch images.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-05-28 20:35:14 +00:00
Brian Goff
ddd67b2535 Make image save more like the OCI layout for blobs
This moves the blobs around so they follow the OCI spec.
Note that because docker reads paths from the manifest.json inside the
tar this is not a breaking change.

This does, however, remove the old layer "VERSION" file which had a big
"why is this even here" in the code comments. I suspect it does not
matter at all even for really old versions of Docker. In any case it is
a useless file for any even relatively modern version of Docker.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-05-22 22:29:29 +00:00
arcosx
521c2b25c2 docs: fix JSON format error
Signed-off-by: arcosx <arcosx@outlook.com>
2023-02-03 08:16:48 +00:00
Sebastiaan van Stijn
937491288e
Merge pull request #43818 from thaJeztah/image_inspect
add support for image inspect with containerd-integration
2023-01-06 17:40:15 +01:00
Nicolas De Loof
1616a09b61 add support for image inspect with containerd-integration
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>
2023-01-05 16:20:41 +01:00
Sebastiaan van Stijn
d131147a5c
use errors.Is() to handle image store errors
The image store's used are an interface, so there's no guarantee
that implementations don't wrap the errors. Make sure to catch
such cases by using errors.Is.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-02 09:41:50 +01:00
Sebastiaan van Stijn
1de3966b84
image: store: rename vars that collided with types or shadowed vars
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-01 13:05:56 +01:00
Sebastiaan van Stijn
040b5bbc52
image: store.restore(): use more structured logs
This code below is run when restoring all images (which can be "many"),
constructing the "logrus.WithFields" is deliberately not "DRY", as the
logger is only used for error-cases, and we don't want to do allocations
if we don't need it. A "f" type-alias was added to make it ever so slightly
more DRY, but that's just for convenience :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-01 13:05:49 +01:00
Sebastiaan van Stijn
456ea1bb1d
image: deprecate IDFromDigest()
Having this function hides what it's doing, which is just to type-cast
to an image.ID (which is a digest). Using a cast is more transparent,
so deprecating this function in favor of a regular typecast.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-01 12:33:00 +01:00
Nicolas De Loof
8fb71ce208
manage image inspect data in backend
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>
2022-12-09 19:02:12 +01:00
Paweł Gronowski
e214503789
image/store: Use errdefs for errors
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2022-12-08 17:17:07 +01:00
Sebastiaan van Stijn
7bbf2fb652
Merge pull request #44428 from thaJeztah/fix_usage_of_deprecated_funcs
Remove uses of deprecated go-digest.NewDigestFromHex, go-digest.Digest.Hex
2022-11-10 17:52:43 +01:00
Sebastiaan van Stijn
0f7c9cd27e
Remove uses of deprecated go-digest.NewDigestFromHex, go-digest.Digest.Hex
Both of these were deprecated in 55f675811a,
but the format of the GoDoc comments didn't follow the correct format, which
caused them not being picked up by tools as "deprecated".

This patch updates uses in the codebase to use the alternatives.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-08 16:42:13 +01:00
Sebastiaan van Stijn
6174d00c03
replace distribution/digestset with opencontainers/go-digest/digestset
opencontainers/go-digest is a 1:1 copy of the one in distribution. It's no
longer used in distribution itself, so may be removed there at some point.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-08 14:15:13 +01:00
Sebastiaan van Stijn
8a2e1245d4
runconfig, oci, image, layer, distribution: fix empty-lines (revive)
runconfig/config_test.go:23:46: empty-lines: extra empty line at the start of a block (revive)
    runconfig/config_test.go:75:55: empty-lines: extra empty line at the start of a block (revive)

    oci/devices_linux.go:57:34: empty-lines: extra empty line at the start of a block (revive)
    oci/devices_linux.go:60:69: empty-lines: extra empty line at the start of a block (revive)

    image/fs_test.go:53:38: empty-lines: extra empty line at the end of a block (revive)
    image/tarexport/save.go:88:29: empty-lines: extra empty line at the end of a block (revive)

    layer/layer_unix_test.go:21:34: empty-lines: extra empty line at the end of a block (revive)

    distribution/xfer/download.go:302:9: empty-lines: extra empty line at the end of a block (revive)
    distribution/manifest_test.go:154:99: empty-lines: extra empty line at the end of a block (revive)
    distribution/manifest_test.go:329:52: empty-lines: extra empty line at the end of a block (revive)
    distribution/manifest_test.go:354:59: empty-lines: extra empty line at the end of a block (revive)

    registry/config_test.go:323:42: empty-lines: extra empty line at the end of a block (revive)
    registry/config_test.go:350:33: empty-lines: extra empty line at the end of a block (revive)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-28 01:58:52 +02:00
Sebastiaan van Stijn
f6b695d2fb
use consistent alias for gotest.tools/v3/assert/cmp
Make sure we use the same alias everywhere for easier finding,
and to prevent accidentally introducing duplicate imports with
different aliases for the same package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-09-08 16:45:16 +02:00
Sebastiaan van Stijn
509f19f611
replace pkg/system Sequential funcs with moby/sys/sequential
Migrating these functions to allow them being shared between moby, docker/cli,
and containerd, and to allow using them without importing all of sys / system,
which (in containerd) also depends on hcsshim and more.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-30 09:33:49 +02:00
Sebastiaan van Stijn
78095e4d12
Remove unused image/v1 code
This image format is only used for docker save / docker load.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-05-10 23:45:03 +02: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
a0230f3d9a
remove unneeded "digest" alias for "go-digest"
I think this was there for historic reasons (may have been goimports expected
this, and we used to have a linter that wanted it), but it's not needed, so
let's remove it (to make my IDE less complaining about unneeded aliases).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-04 14:49:42 +01:00
Sebastiaan van Stijn
06df530b6d
image: improve godoc for V1Image
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-03 22:57:03 +01:00
Sebastiaan van Stijn
1ef0a5bb91
image: remove leftover LCOW platform checks
This removes some of the checks that were added in 0cba7740d4,
but should no longer be needed.

- `image/store.Delete()`: no need to validate image platform to delete it.
- `image/tarexporter/takeLayerReference()`: use `image.OperatingSystem()` and
  fail early to prevent constructing the `ChainID()`.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-25 12:18:44 +01:00
haining.cao
715e78631d fix image spec JSON example
Signed-off-by: haining.cao <haining.cao@daocloud.io>
2021-11-22 23:37:23 +08:00