Skip to content

Commit 818bccf

Browse files
authored
docs: Add instructions for OCI export from Docker (#4135)
Signed-off-by: Daniel Smith <daniel@razorsecure.com>
1 parent 50120bc commit 818bccf

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

docs/image-cache.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,31 @@ is provided, it always will pull, independent of what is in the cache.
5959

6060
The read process is smart enough to check each blob in the local cache before downloading
6161
it from a registry.
62+
63+
## Imports from local Docker instance
64+
65+
To import an image from your local Docker daemon into LinuxKit, you’ll need to ensure the image is exported in the [OCI image format](https://docs.docker.com/build/exporters/oci-docker/), which LinuxKit understands.
66+
67+
This requires using a `docker-container` [buildx driver](https://docs.docker.com/build/builders/drivers/docker-container/), rather than the default.
68+
69+
Set it up like so:
70+
71+
```shell
72+
docker buildx create --driver docker-container --driver-opt image=moby/buildkit:latest --name=ocibuilder --bootstrap
73+
```
74+
75+
Then build and export your image using the OCI format:
76+
77+
```shell
78+
docker buildx build --builder=ocibuilder --output type=oci,name=foo . > foo.tar
79+
```
80+
81+
You can now import it into LinuxKit with:
82+
83+
```shell
84+
linuxkit cache import foo.tar
85+
```
86+
87+
Note that this process, as described, will only produce images for the platform/architecture you're currently on. To produce multi-platform images requires extra docker build flags and external builder or QEMU support - see [here](https://docs.docker.com/build/building/multi-platform/).
88+
89+
This workaround is only necessary when working with the local Docker daemon. If you’re pulling from Docker Hub or another registry, you don’t need to do any of this.

0 commit comments

Comments
 (0)