-
Notifications
You must be signed in to change notification settings - Fork 608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support builds using base images on IPFS (nerdctl build --ipfs
)
#525
Conversation
nerdctl build --ipfs
)nerdctl build --ipfs
)
Maybe this flag should be like |
``` | ||
nerdctl ipfs registry down | ||
nerdctl ipfs registry up --registry-address=localhost:5555 | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should recommend this tool for Kubernetes users too, until we can get kube-apiserver and CRI to support IPFS image refs
cmd/nerdctl/ipfs_registry_serve.go
Outdated
Use: "serve", | ||
Short: "serve read-only registry backed by IPFS", | ||
RunE: ipfsRegistryServeAction, | ||
Hidden: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to hide this?
} | ||
|
||
// runRegistryAsContainer runs "nerdctl ipfs registry serve" as a container with --net=host. | ||
// This function bind mounts nerdctl binary to a directory and runs that directory as the rootfs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn’t work when the nerdctl binary is dynamically linked.
In such case this command should print a human-readable error that recommends to use the serve command directly
248b51c
to
43ea0c5
Compare
README.md
Outdated
|
||
Flags: | ||
- :nerd_face: `--ipfs-address`: Multiaddr of IPFS API (default is pulled from `$IPFS_PATH/api` file. If `$IPFS_PATH` env var is not present, it defaults to `~/.ipfs`). | ||
- :nerd_face: `--listen-registry-port`: Listening port on localhost (default `5050`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this like --listen-registry=localhost:5050
so that we can specify non-localhost address too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
017fbb6
to
97968ca
Compare
Signed-off-by: Kohei Tokunaga <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done
#465
This adds the ability to build images using base images on IPFS.
Now nerdctl can build, ship and run containers on IPFS, without registries.
To complete this patch, moby/buildkit@bb2e7ce needs to be relesed in BuildKit.
Currently this PR uses binaries built in a forked repo https://github.com/ktock/buildkit/releases/tag/v0.9.x-20211117.3 .Released as v0.9.3 https://github.com/moby/buildkit/releases/tag/v0.9.3
Dockerfile
In Dockerfile, instead of
ipfs://
prefix, you need to use the following image reference to point to an image on IPFS.Example Dockerfile:
build
--ipfs
options is required.compose
Compose also supports
--ipfs
option.Details about
localhost:5050/ipfs/<CID>
As of now, BuildKit doesn't support
ipfs://
prefix. So nerdctl achieves builds on IPFS by having a read-only local registry backed by IPFS. This registry converts registry API requests to IPFS operations. IPFS-agnostic tools can pull images from IPFS via this registry.When you specify
--ipfs
option tonerdctl bulid
, it automatically starts the registry backed by the IPFS repo of the current$IPFS_PATH
. By default, nerdctl exposes the registry atlocalhost:5050
. You can change the address and can manually restart the registry usingnerdctl ipfs registry up
andnerdctl ipfs registry down
.The following example changes the registry API address to
localhost:5555
instead oflocalhost:5050
.You'll also need to restart the registry when you change
$IPFS_PATH
to use.moby/buildkit@bb2e7ce needs to be released in BuildKit and use the released binaries.ipfs://
prefix in Dockerfile