Commit graph

31 commits

Author SHA1 Message Date
Paweł Gronowski
9cb5da400c
images/Children: Return error
Change return value in function signature and return fatal errors so
they can actually be reported to the caller instead of just being logged
to daemon log.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-13 16:20:02 +02:00
Sebastiaan van Stijn
74a0fdf961
Merge pull request #45265 from vvoland/c8d-children-upstream
c8d: Implement Children by comparing diff ids
2023-04-11 15:45:27 +02:00
Sebastiaan van Stijn
a5d46a15f5
split GetRepository from ImageService
The GetRepository method interacts directly with the registry, and does
not depend on the snapshotter, but is used for two purposes;

For the GET /distribution/{name:.*}/json route;
dd3b71d17c/api/server/router/distribution/backend.go (L11-L15)

And to satisfy the "executor.ImageBackend" interface as used by Swarm;
58c027ac8b/daemon/cluster/executor/backend.go (L77)

This patch removes the method from the ImageService interface, and instead
implements it through an composite struct that satisfies both interfaces,
and an ImageBackend() method is added to the daemon.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

remove GetRepository from ImageService

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-04-09 12:07:57 +02:00
Paweł Gronowski
e0f36f9d8b
ImageService: Pass ctx to Children
This only makes the containerd ImageService implementation respect
context cancellation though.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-04-06 14:27:38 +02:00
Sebastiaan van Stijn
7c93e4a09b
Merge pull request #45241 from rumpl/c8d-image-events
c8d: Add the events services to the containerd image service
2023-03-31 00:31:04 +02:00
Tianon Gravi
f537ef5746
Merge pull request #44963 from vvoland/c8d-push-upstream
c8d: Implement push
2023-03-30 14:43:41 -07:00
Paweł Gronowski
e7393d0fc5
images/push: Accept reference
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>
2023-03-30 18:08:40 +02:00
Djordje Lukic
15b9176d53
Add the events services to the containerd image service
No events are sent yet, these will come at a later stage.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2023-03-30 17:48:51 +02:00
Laura Brehm
4c459ddabd
c8d: add support for docker diff
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-03-30 10:29:07 +01:00
Cory Snider
3991faf464 Move filtered registry search out of image service
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>
2023-03-10 18:36:33 -05:00
Nicolas De Loof
06619763a2
remove GetLayerByID from ImageService interface
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>
2023-03-10 17:54:55 +01:00
Laura Brehm
45ee4d7c78
c8d: Compute container's layer size
Co-authored-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-03-08 00:58:02 +01:00
Laura Brehm
a34060cdb4
Resolve and store manifest when creating container
This addresses the previous issue with the containerd store where, after a container is created, we can't deterministically resolve which image variant was used to run it (since we also don't store what platform the image was fetched for).

This is required for things like `docker commit`, and computing the containers layer size later, since we need to resolve the specific image variant.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-03-06 15:13:36 +01:00
Paweł Gronowski
1ca85e835c
daemon/imageService: Remove TagImageWithReference
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>
2023-02-07 15:43:52 +01:00
Nicolas De Loof
7b6f71dced
daemon: Pass ctx to image tagging operations
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-02-07 15:43:48 +01:00
Djordje Lukic
0137446248 Implement run using the containerd snapshotter
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>

c8d/daemon: Mount root and fill BaseFS

This fixes things that were broken due to nil BaseFS like `docker cp`
and running a container with workdir override.

This is more of a temporary hack than a real solution.
The correct fix would be to refactor the code to make BaseFS and LayerRW
an implementation detail of the old image store implementation and use
the temporary mounts for the c8d implementation instead.
That requires more work though.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>

daemon/images: Don't unset BaseFS

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-02-06 18:21:50 +01:00
Nicolas De Loof
9b5c21309b
images: Pass context to commit related operations
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-01-18 12:23:32 +01:00
Paweł Gronowski
28327f10a2
daemon/import: Extract common logic to api
Extract logic that would need to be duplicated in both implementations
of ImageService.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-01-11 13:53:40 +01:00
Sebastiaan van Stijn
a8eb15eafb
ImageService.ImageHistory(): pass context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-09 19:00:49 +01:00
Paweł Gronowski
dec81e489f
daemon/disk_usage: Use context aware singleflight
The singleflight function was capturing the context.Context of the first
caller that invoked the `singleflight.Do`. This could cause all
concurrent calls to be cancelled when the first request is cancelled.

singleflight calls were also moved from the ImageService to Daemon, to
avoid having to implement this logic in both graphdriver and containerd
based image services.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2022-11-29 16:46:19 +01:00
Nicolas De Loof
def549c8f6
imageservice: Add context to various methods
Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2022-11-03 12:22:40 +01:00
Sebastiaan van Stijn
779a5b3029 ImageService.GetImage(): pass context
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2022-09-07 16:53:45 +02:00
Sebastiaan van Stijn
ce550fa9c2
Merge pull request #43968 from thaJeztah/implement_GetImageOpts
introduce GetImageOpts to manage image inspect data in backend
2022-08-24 19:07:30 +02:00
Sebastiaan van Stijn
8dd14509d7
ImageService: rename GraphDriverName to StorageDriver
Make the function name more generic, as it's no longer used only
for graphdrivers but also for snapshotters.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-08-18 09:44:51 +02:00
Nicolas De Loof
9a849cc83a
introduce GetImageOpts to manage image inspect data in backend
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>
2022-08-16 16:49:46 +02:00
Nicolas De Loof
50fb999bb1
add image load/save support
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2022-08-04 09:41:19 +02:00
Brian Goff
7e8df0e2c9
Merge pull request #43820 from thaJeztah/image_delete
containerd integration: Implement ImageDelete for containerd
2022-08-03 15:47:07 -07:00
Sebastiaan van Stijn
a02abca49a
daemon: use types/registry.AuthConfig
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-29 23:05:18 +02:00
Djordje Lukic
26c65447df
Implement ImageDelete for containerd
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-28 22:56:34 +02:00
Sebastiaan van Stijn
7b510fda0c
daemon: ImageService: remove unused Map() method
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-18 11:32:31 +02:00
Djordje Lukic
5b0eb69635
Extract ImageService interface from the image service
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-08 13:50:53 +02:00