-
Notifications
You must be signed in to change notification settings - Fork 368
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
Use kaniko to build container image #560
Comments
There is currently no support for kaniko. I don't have any experience with kaniko so it is hard to judge how much work it would be. I think it could be feasible but step one would be to look at the current code and how to introduce a level of abstraction so that dockerd and kaniko can be swapped out for building images. |
For those that are interested, I've created a bootstrapped workaround for BinderHub to run an unprivileged Kaniko builder for Added to the
|
I'd like to raise more attention to this issue due to a few developments in the past couple years. Docker has become deprecated in K8S, and using containerd/DIND and exposing the docker socket is a security vulnerability. Unprivileged Kaniko containers are one of the only ways to securely build on K8S: https://kurtmadel.com/posts/native-kubernetes-continuous-delivery/building-container-images-with-kubernetes/ It looks like this was attempted a few years ago: jupyterhub/zero-to-jupyterhub-k8s#1225 but there was concerns it would be too slow. Kaniko run flags ( Hoping to see Kaniko integration soon! |
repo2docker added support for alternative container engines last year #848 For example, I've written a daemonless root-less podman backend https://github.com/manics/repo2podman (note if you're happy to run a rootless daemon you should be able to use rootless podman with it's docker compatible socket instead). BinderHub also gained support for pluggable backends, for example you can now run it with Docker or Podman without a Kubernetes cluster: https://github.com/jupyterhub/binderhub/tree/master/testing/local-binder-local-hub The registry component of BinderHub can also be overidden so in principle if your builder and spawner wanted to use some other type of arbitrary storage instead of a container registry that would also be possible. This should mean the basic framework is in place to support other container builders and run-times. To start with I think someone needs to implement Kaniko as an alternative builder for repo2docker. |
I am really interested in running the BinderHub with your Kaniko builder workaround. However, I can't find any specific steps to follow. What I've done so far is:
But the build fails due to failed volume mount of a build pod
Which, I assume, is expected because when using Kaniko for building, docker socket is not to be used. I think I am missing an option where to select your Kaniko workaround as a used builder but I can't find a place where to select it. Maybe option in values.yaml file:
? |
For those who would like to continue and reproduce the workaround from @MatthewBM, having the same issue as me, I found a solution. KanikoBuilder class inherits from Build, which (I assume) is no longer supported. Instead of build, one needs to import KubernetesBuildExecutor. There are also few compatibility issues after that but they can be quickly resolved by looking at binder pod logs, requiring small changes in the workaround script.
|
I've written a repo2docker extension to use Kaniko: If you use the latest BinderHub that includes jupyterhub/binderhub#1766 and jupyterhub/binderhub#1795 this config should work: config:
KubernetesBuildExecutor:
docker_host:
build_image: "quay.io/manics/repo2kaniko:0.1.0"
repo2docker_extra_args:
- --engine=kaniko
- --debug
imageCleaner:
enabled: false Unfortunately Kaniko doesn't build all repositories, so far I've noticed problems with https://github.com/manics/jupyter-remote-desktop-proxy/ and some RStudio repos. |
I'd like to build container images during CI inside an unprivileged Docker container where DIND is not available.
Is it possible to use kaniko instead of Docker directly to build the container image with repo2docker?
If not, would it be feasible to add support for building with kaniko in repo2docker?
The text was updated successfully, but these errors were encountered: