-
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
Shell out to docker buildx build
to build images
#1402
base: main
Are you sure you want to change the base?
Conversation
pydocker uses the HTTP API (equivalent to `docker build`) which has been dead for ages. `docker buildx` (the interface to BuildKit) is what we *should* be using, but alas pydocker does not currently support it and I suspect it never will (docker/docker-py#2230). This PR simply shells out, as I think that's the way. Fixes jupyterhub#875
This isn't complete, putting it up here to see how many tests fail. |
for more information, see https://pre-commit.ci
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.
Nice! This will also unblock using COPY --chmod
as in #1395
Re: extra_build_args
, presumably we do want to keep an equivalent passthrough for extra args to pass to buildx build
on the command-line (a list this time)?
platform=platform, | ||
**kwargs, | ||
) | ||
if not shutil.which("docker"): |
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.
Looks like rm
and forcerm
don't have equivalents. Just noting that this is intentional. Are there likely to be significant changes in the cache behavior with buildkit we need to pay attention to?
@minrk I added |
bdc2241
to
5b96156
Compare
for more information, see https://pre-commit.ci
Trying to fix https://jupyter.zulipchat.com/#narrow/channel/469744-jupyterhub/topic/try.20mybinder.20jupyterleab.20demo.20broken, which is breaking because mamba gets OOM killed. We have memory limits set on dind as a whole, and memory_limit for builds (in its current, per-build form) is going away as part of jupyterhub/repo2docker#1402 as well. So let's remove it and see.
@@ -69,6 +74,14 @@ class DockerEngine(ContainerEngine): | |||
config=True, | |||
) | |||
|
|||
extra_buildx_build_args = List( | |||
[], |
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.
If you want to specify the type of items in the list, give a single TraitType instance here (not list):
[], | |
Unicode(), |
iidfile looks like it might be a good arg to test with, since it just creates a file to check. Or |
Here's a small test for extra buildx args with
which outputs (among other things):
|
pydocker uses the HTTP API (equivalent to
docker build
) which has been dead for ages.docker buildx
(the interface to BuildKit) is what we should be using, but alas pydocker does not currently support it and I suspect it never will (docker/docker-py#2230).This PR simply shells out, as I think that's the way.
I'm going to list some intentional choices I've made here.
DockerEngine
than make a new one. The old way is deprecated and we should not support it.dockerpy
for all other non-build operations. It works fine and I don't see a need to change it right now.container_limits
(because buildx doesn't support it, it should be set at the level of the builder instead)Questions to answer
Traitlets to deprecate
Repo2Docker.build_memory_limit
- this must be instead set up by the builderRepo2Docker.extra_build_args
- as this is purely about pydocker's build method that we no longer useFixes #875