Skip to content
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

[MRG] Define an interface for Container engines #848

Merged
merged 21 commits into from
Jul 2, 2021

Conversation

manics
Copy link
Member

@manics manics commented Feb 11, 2020

Summary

Closes #682

  • Abstract the interface that builds a Dockerfile (defined in repo2docker/engine.py). Engines are LoggingConfigurable- in future this could allow advanced configuration though the repo2docker config file. This is the file that needs the most review since it defines the specification for others.
  • Implement docker (via docker-py) as the default implementation (see repo2docker/docker.py)

This is based on my attempt at a podman backend in #806

In general most of the Docker Client methods could be easily implemented in a Podman wrapper.

Details

The main exceptions are build() and push_image():

Remaining todos:

  • Fix unit tests
  • Remove commented lines/in-progress notes
  • Update podman backend WIP: Podman backend #806 to implement this interface as verification of the design, either in this repo or as an external plugin with a repo2docker.engine entrypoint

Other engines

I've switched to using an entrypoint for ContainerEngine implementations. The default docker engine remains in this project. I've moved #806 (WIP: Podman backend) into a new project: https://github.com/manics/repo2docker-podman. Instructions are included in that project's README.

@@ -11,15 +11,15 @@
import sys
import logging
import os
import entrypoints
Copy link
Member Author

@manics manics Feb 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new dependency, but it's already used in other Jupyter projects such as jupyterhub for managing entrypoints:
https://github.com/jupyterhub/jupyterhub/blob/bc7bb5076ff2deabc7702c75dce208166d14568e/requirements.txt#L4

@@ -3,3 +3,5 @@ repos:
rev: 18.9b0
hooks:
- id: black
# Doesn't work:
# args: [--target-version py35]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-commit/black formats the files as Python 3.6 but this is incompatible with Python 3.5 and the above config doesn't work.
See the # fmt: off comments in repo2docker/docker.py for the alternative workaround.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully #849 will fix this

tag : str
Tag to add to the image

custom_context : bool
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

custom_context and fileobj and very biased towards the Docker API. However it's fairly easy in Python to untar this tarfile-like-object into a temporary directory so it can be made to work.

@manics manics changed the title WIP: Define an interface for Container engines [MRG] Define an interface for Container engines Feb 14, 2020
@manics manics marked this pull request as ready for review February 14, 2020 22:53
manics added a commit to manics/repo2podman that referenced this pull request Feb 15, 2020
@meeseeksmachine
Copy link

This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/brainstorming-repo2docker-action-vm-on-gcp-aws-azure/5345/16

@meeseeksmachine
Copy link

This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/binderhub-for-hpc/143/18

@yuvipanda
Copy link
Collaborator

@manics I'm happy to merge this now if you can do a rebase - so we can catch any test failures that might happen right after we merge. I tried doing it locally and ran into a couple conflicts...

@meeseeksmachine
Copy link

This pull request has been mentioned on Jupyter Community Forum. There might be relevant details there:

https://discourse.jupyter.org/t/building-a-the-littlest-binderhub/9824/1

@manics manics changed the title [MRG] Define an interface for Container engines [needs-rebase] Define an interface for Container engines Jul 1, 2021
@manics manics changed the title [needs-rebase] Define an interface for Container engines [MRG] Define an interface for Container engines Jul 2, 2021
@manics
Copy link
Member Author

manics commented Jul 2, 2021

@yuvipanda Rebased! Just the CircleCI test that's still failing (#1050)

@yuvipanda yuvipanda merged commit 520c7ad into jupyterhub:master Jul 2, 2021
@yuvipanda
Copy link
Collaborator

@manics awesome. That's fine I think.

@yuvipanda
Copy link
Collaborator

@manics exciting change!!!! Thank you for working on it and pushing it through. I think once the podman backend and repo2docker have a a release, what do you think of a blog post?

@manics
Copy link
Member Author

manics commented Jul 2, 2021

I'm happy to contribute to a blog post! I need to figure out a more reliable way to install podman as the tests have broken again: manics/repo2podman#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide 'podman' as a build backend
3 participants