Make an imagebuilding hub#

We can support users who want to build, push and launch user images, from open source GitHub repositories, similar with what does, but from within their JupyterHubs

We call this an imagebuilding style hub and the primary features offered would be:

  • User authentication

  • Persistent storage

  • Server options allowing:

    • pre-defined list of images to choose from

    • specifying another image, different from the ones in the pre-defined list

    • building and pushing an image to a registry from a GitHub repository

Use the dynamic-image-building-experiment hub image#

We will need to use jupyterhub-fancy-profiles, but this Python package isn’t installed in the default image deployed with our hubs, so we should use the dynamic-image-building-experiment hub image instead.

      tag: ""

Connect with jupyterhub-fancy-profiles#

  1. The jupyterhub-fancy-profiles project provides a user facing frontend for connecting the JupyterHub to the BinderHub service, allowing the users to build their own images similar with how they would on

          enable-fancy-profiles: |
            from jupyterhub_fancy_profiles import setup_ui
  2. Since jupyterhub-fancy-profiles adds on to the profileList feature of KubeSpawner, we need to configure a profile list here as well. Edit and update the following configuration per the community requesting the hub needs.

          - display_name: "Only Profile Available, this info is not shown in the UI"
            slug: only-choice
                display_name: Image
                  enabled: True
                  display_name: "Custom image"
                  validation_regex: "^.+:.+$"
                  validation_message: "Must be a publicly available docker image, of form <image-name>:<tag>"
                  display_name_in_choices: "Specify an existing docker image"
                  description_in_choices: "Use a pre-existing docker image from a public docker registry (dockerhub, quay, etc)"
                    image: "{value}"
                    display_name: Pangeo Notebook Image
                    description: "Python image with scientific, dask and geospatial tools"
                      image: pangeo/pangeo-notebook:2023.09.11
                    display_name: Jupyter SciPy Notebook
                    slug: scipy

Setup the image registry#

For GCP (via terraform)#

If the hub will be deployed on a GCP cluster, we can setup via the terraform config.

  1. Enable the repository creation by adding the following in the cluster’s terraform config:

    container_repos = [

    where is the name of the repository where all the images built from the hub will be pushed.


    If a container_repos config already exists, then, just add the new repository name to this list.

  2. Get the registry credentials

    The username to access this registry is _json_key and the password can be discovered by running the following terraform command:

    terraform output registry_sa_keys


    Store these somewhere safe as we will need them in a following step.

For other cloud providers (

If the hub will be deployed on another cloud provider than GCP, we must setup a new organization and a robot account to push and pull from it.

  1. Go to and create a new organization. Give it a memorable name like -.

  2. Make sure this new organization is selected, by going to

  3. Select the ‘Robot Accounts’ option on the left menu.

  4. Click ‘Create Robot account’, give it a memorable name (such as image_builder) and click ‘Create’.

  5. In the next screen, don’t select any of the existing repositories, as we need this robot account to have enough permissions to push any new repository under the organization, so permissions to existing repositories is not needed.

  6. Once done, click the name of the robot account again. This will give you its username and password.


    Store these somewhere safe as we will need them in a following step.

  7. Select the ‘Team and Membership’ option on the left menu.

  8. Click on the ‘Options’ wheel of the owners team, then select ‘Manage Team Members’.

  9. Type in the name of the robot account that you created, select it from the list and add it to the owners team.

  10. Add also the other engineers as members of this new organization by searching their handles in the search bar on the right.

Setup the binderhub-service chart#

We will use the binderhub-service Helm chart to run BinderHub, the Python software, as a standalone service to build and push images with repo2docker, next to JupyterHub.

  1. Setup the binderhub-service config

      enabled: true
          # something like <region><project-name>/<repository-name> for
          # or for
          image_prefix: <repository_path>
        # registry server address like or
        server: <server_address>
        # robot account namer or "_json_key" if using
        username: <account_name>
  2. Sops-encrypt and store the password for accessing the image registry, in the enc-<hub>.secret.values.yaml file.

    You should have the password for accessing the image registry from a previous step.

        password: <password>
  3. If pushing to registry, also setup the credentials for image pulling

    When pushing to the quay registry, the images are pushed as private by default (even if the plan doesn’t allow it).

    A quick workaround for this, is to use the robot’s account credentials to also set imagePullSecret in the enc-<hub>.secret.values.yaml:

          create: true
          username: <robot_account_name>
          password: <password>