<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Jupyter Blog - Docker</title><link href="https://jasongrout.github.io/medium-archive/pelican/" rel="alternate"/><link href="https://jasongrout.github.io/medium-archive/pelican/feeds/tag-docker.atom.xml" rel="self"/><id>https://jasongrout.github.io/medium-archive/pelican/</id><updated>2024-04-17T09:01:00+00:00</updated><subtitle>The Project Jupyter blog: news, releases, and community stories, archived from blog.jupyter.org.</subtitle><entry><title>CUDA enabled Jupyter Docker Images</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2024/cuda-enabled-jupyter-docker-images/" rel="alternate"/><published>2024-04-16T22:08:00+00:00</published><updated>2024-04-17T09:01:00+00:00</updated><author><name>Ayaz Salikhov</name></author><id>tag:jasongrout.github.io,2024-04-16:/medium-archive/pelican/posts/2024/cuda-enabled-jupyter-docker-images/</id><summary type="html">&lt;p&gt;I am happy to announce that Jupyter Docker Stacks project now provides GPU accelerated Docker images. This allows PyTorch or TensorFlow…&lt;/p&gt;
</summary><content type="html">&lt;p&gt;I am happy to announce that &lt;a href="https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html"&gt;Jupyter Docker Stacks project&lt;/a&gt; now provides GPU accelerated Docker images. This allows PyTorch or TensorFlow operations to use compatible NVIDIA GPUs for accelerated computation.&lt;/p&gt;
&lt;h3 id="how-to-find-these-images"&gt;How to find these images&lt;/h3&gt;
&lt;p&gt;All our images are available on &lt;a href="https://quay.io/organization/jupyter"&gt;Quay.io registry&lt;/a&gt;. We provide CUDA accelerated versions of images are available for &lt;code&gt;tensorflow-notebook&lt;/code&gt; and &lt;code&gt;pytorch-notebook&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To use such an image, you have to specify a special prefix tag to the image: versioned CUDA prefix like &lt;code&gt;cuda11-&lt;/code&gt; or &lt;code&gt;cuda12-&lt;/code&gt; for &lt;code&gt;pytorch-notebook&lt;/code&gt; or just &lt;code&gt;cuda-&lt;/code&gt; for &lt;code&gt;tensorflow-notebook&lt;/code&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We build &lt;code&gt;pytorch-notebook&lt;/code&gt; only for 2 last major versions of CUDA, &lt;code&gt;tensorflow-notebook&lt;/code&gt; image supports only the latest CUDA version listed in the &lt;a href="https://www.tensorflow.org/install/source#gpu"&gt;officially tested build configurations&lt;/a&gt; list. CUDA-enabled images are available on x86_64 platform.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For example, you can use an image &lt;code&gt;quay.io/jupyter/pytorch-notebook:cuda12-python-3.11.8&lt;/code&gt; or &lt;code&gt;quay.io/jupyter/tensorflow-notebook:cuda-latest&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="running-the-images"&gt;Running the images&lt;/h3&gt;
&lt;p&gt;To enable CUDA support on &lt;strong&gt;Linux&lt;/strong&gt; host machine, you need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;have compatible Nvidia GPU&lt;/li&gt;
&lt;li&gt;have NVIDIA Linux driver installed&lt;/li&gt;
&lt;li&gt;add &lt;code&gt;--gpus all&lt;/code&gt; (or &lt;code&gt;--gpus '&amp;quot;device=all&amp;quot;'&lt;/code&gt;) flag to if you’re using &lt;code&gt;Docker&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;add &lt;code&gt;--device 'nvidia.com/gpu=all'&lt;/code&gt; flag if you’re using &lt;code&gt;Podman&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, you can run the image like this: &lt;code&gt;docker run -it --rm -p 8888:8888 --gpus all quay.io/jupyter/tensorflow-notebook:cuda-latest&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can also enable GPU support on &lt;strong&gt;Windows&lt;/strong&gt; using &lt;a href="https://docs.docker.com/desktop/gpu/"&gt;Docker&lt;/a&gt; or &lt;a href="https://github.com/containers/podman/issues/19005"&gt;Podman&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="reaching-out"&gt;Reaching out&lt;/h3&gt;
&lt;p&gt;You will find our documentation &lt;a href="http://jupyter-docker-stacks.readthedocs.io"&gt;here&lt;/a&gt;.&lt;br&gt;
If you encounter any problems, please, take a look at &lt;a href="https://github.com/jupyter/docker-stacks"&gt;GitHub issues&lt;/a&gt;.&lt;br&gt;
If you would like to improve GPU support in our images, please, reach out &lt;a href="https://github.com/jupyter/docker-stacks/issues/1557"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="acknowledgments"&gt;Acknowledgments&lt;/h3&gt;
&lt;p&gt;I would like to thank:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/johanna-reiml-hpi"&gt;Johanna Reiml&lt;/a&gt;, for implementing general &lt;code&gt;variant&lt;/code&gt; concept for our images and making it work for &lt;code&gt;pytorch-notebook&lt;/code&gt; (PR &lt;a href="https://github.com/jupyter/docker-stacks/pull/2091"&gt;#2091&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/ChristofKaufmann"&gt;Christof Kaufmann&lt;/a&gt;, for making it work for &lt;code&gt;tensorflow-notebook&lt;/code&gt; (PR &lt;a href="https://github.com/jupyter/docker-stacks/pull/2100"&gt;#2100&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/benz0li"&gt;Olivier Benz&lt;/a&gt;, for helping me out to write this blog post&lt;/li&gt;
&lt;/ul&gt;
</content><category term="Docker"/><category term="machine learning"/></entry><entry><title>Updating defaults on mybinder.org</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2023/updating-defaults-on-mybinder-org/" rel="alternate"/><published>2023-03-09T08:31:00+00:00</published><updated>2023-03-10T15:53:00+00:00</updated><author><name>Min RK</name></author><id>tag:jasongrout.github.io,2023-03-09:/medium-archive/pelican/posts/2023/updating-defaults-on-mybinder-org/</id><summary type="html">&lt;p&gt;This week, we are deploying some updates to repo2docker, the image-building tool that underpins mybinder.org. This may affect your repos…&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2023/updating-defaults-on-mybinder-org/images/001-1_0dd02RZZwHXDo-Fr3tdB5w.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;This week, we are deploying some updates to &lt;a href="http://repo2docker.readthedocs.io"&gt;repo2docker&lt;/a&gt;, the image-building tool that underpins &lt;a href="https://mybinder.org/"&gt;mybinder.org&lt;/a&gt;. This may affect your repos. Please &lt;a href="https://discourse.jupyter.org/c/binder/12"&gt;get in touch&lt;/a&gt; if you have problems! Hopefully this will make things better, more stable, and &lt;em&gt;less&lt;/em&gt; surprising overall, but change always breaks &lt;em&gt;something&lt;/em&gt;, however hard we work to keep things working.&lt;/p&gt;
&lt;p&gt;To highlight the changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python 3.10 is now the default Python version&lt;/li&gt;
&lt;li&gt;Python 3.11 is now supported, and new versions of Python should be supported more quickly&lt;/li&gt;
&lt;li&gt;If a repo requests an old version of Python (≤ 3.6), it will be installed in a separate environment, as we’ve been doing with Python 2.7 for a long time.&lt;/li&gt;
&lt;li&gt;The server implementation is switched from &lt;code&gt;jupyter-notebook&lt;/code&gt; to &lt;code&gt;jupyter-server&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;More detail on each change, the reasons behind them, and their consequences below.&lt;/p&gt;
&lt;h2 id="python-311-and-separate-envs-for-legacy-python-support"&gt;Python 3.11 and separate envs for legacy Python support&lt;/h2&gt;
&lt;p&gt;When building an image, repo2docker installs packages in one or two environments — the &lt;strong&gt;kernel&lt;/strong&gt; environment where your code runs, and the &lt;strong&gt;server&lt;/strong&gt; environment, which runs the Jupyter server. If you’re using a reasonably supported version of Python, these are actually the same environment. This is the vast majority of repositories on mybinder.org. In order to function properly, we have certain requirements of what goes in the ‘server’ environment. Eventually, those requirements start making it difficult to setup the server environment with an outdated version of Python, as packages march ahead with their minimum required Python (The widely adopted &lt;a href="https://numpy.org/neps/nep-0029-deprecation_policy.html#support-table"&gt;NEP 29&lt;/a&gt; suggested dropping Python 3.7 support in December, 2021). Our solution for this has been to separate the kernel environment from the server environment, so they don’t create a conflict. Until recently, only Python 2 was handled this way (most packages dropped Python 2 support years ago). As part of adding support for Python 3.11, we have expanded this behavior to include Python ≤3.6, so if you are using a ‘legacy Python’, currently defined to be Python ≤3.6, your requested packages will be installed in the kernel environment instead of the server environment. This &lt;em&gt;should&lt;/em&gt; only have a noticeable effect if you are installing something with server extension components , which includes anything modifying the JupyterLab or notebook interfaces— those will not be available in the server environment. To address this, you will have to upgrade Python &lt;em&gt;or&lt;/em&gt; handle the server extension installation in &lt;code&gt;postBuild&lt;/code&gt; . &lt;a href="https://github.com/jupyterhub/repo2docker/pull/1239"&gt;PR adding Python 3.11 and adding Python ≤3.6 to legacy Python versions&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="default-python-is-now-310"&gt;Default Python is now 3.10&lt;/h2&gt;
&lt;p&gt;The default Python for repo2docker and thereby mybinder.org is now Python 3.10, upgraded from 3.7. 3.10 will be used when a repository does not specify which version of Python to use. Following Python’s own annual release cadence, we plan to update this more regularly in the future, lagging behind Python itself by a version or two. This has no effect on your repos if they specify a Python version, which is why we &lt;a href="https://repo2docker.readthedocs.io/en/latest/howto/languages.html#specifying-a-version-of-python"&gt;&lt;strong&gt;encourage you to specify your Python version&lt;/strong&gt;&lt;/a&gt;! If you don’t, then your Python version &lt;em&gt;will&lt;/em&gt; change over time, probably about once a year. &lt;a href="https://github.com/jupyterhub/repo2docker/pull/1219"&gt;PR switching the default Python&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="now-launching-jupyter-server"&gt;Now launching Jupyter Server&lt;/h2&gt;
&lt;p&gt;The default UI for mybinder.org has been JupyterLab for some time, with the classic notebook still available if you specify a url of &lt;code&gt;/tree/&lt;/code&gt;or &lt;code&gt;/notebooks/mynb.ipynb&lt;/code&gt;. When we rolled out that change, we kept the default &lt;em&gt;server&lt;/em&gt; as the &lt;code&gt;jupyter-notebook&lt;/code&gt; server, for improved compatibility with existing server extensions. As the newer Jupyter Server has taken over, the situation is becoming reversed — using the older &lt;code&gt;notebook&lt;/code&gt; server is now the &lt;em&gt;cause&lt;/em&gt; of compatibility issues with server extensions, so we are switching the server to launch &lt;code&gt;jupyter-server&lt;/code&gt; instead of &lt;code&gt;jupyter-notebook&lt;/code&gt;. The classic UI is still available at the same URLs, thanks to &lt;a href="https://nbclassic.readthedocs.io"&gt;nbclassic&lt;/a&gt;. This &lt;em&gt;should&lt;/em&gt; have no visible effects, as &lt;code&gt;jupyter-server&lt;/code&gt; and &lt;code&gt;nbclassic&lt;/code&gt; make a great deal of effort to keep classic notebook extensions working, but some extensions may need an update for jupyter-server compatibility if they haven’t been updated already. Because of where the server is specified, there is no supported way for images to express a preference for the deprecated &lt;code&gt;notebook&lt;/code&gt; server (&lt;a href="https://github.com/jupyterhub/binderhub/pull/1635"&gt;PR switching the default server command&lt;/a&gt;.&lt;/p&gt;
</content><category term="Binder"/><category term="Docker"/><category term="JupyterHub"/><category term="reproducibility"/></entry><entry><title>Introducing repo2docker</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2018/introducing-repo2docker/" rel="alternate"/><published>2018-12-14T18:24:00+00:00</published><updated>2018-12-14T19:02:00+00:00</updated><author><name>Chris Holdgraf</name></author><id>tag:jasongrout.github.io,2018-12-14:/medium-archive/pelican/posts/2018/introducing-repo2docker/</id><summary type="html">&lt;p&gt;The Binder Project’s repo2docker tool gives data scientists the benefits of containerization technology without needing to learn Docker…&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2018/introducing-repo2docker/images/001-1_mZMTfkZE6o94aIr6DG-hYA.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;The Binder Project’s &lt;a href="https://repo2docker.readthedocs.io/en/latest/"&gt;repo2docker&lt;/a&gt; tool gives data scientists the benefits of containerization technology without needing to learn Docker itself. To make your repository compatible with repo2docker, you only need to add text files that are already present in many repositories. This means that you get the benefits of containerization, a powerful and complex ecosystem, without having to change your workflow.&lt;/p&gt;
&lt;p&gt;repo2docker is a lightweight command-line tool written in Python that takes a path or URL to a git repository and creates a suitable docker image for it. To achieve this it follows the steps that a human would take to do so. The steps are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Inspect the repository for common “configuration” files (like &lt;code&gt;requirements.txt&lt;/code&gt;),&lt;/li&gt;
&lt;li&gt;From these well-known files infer the Docker commands to run; and&lt;/li&gt;
&lt;li&gt;Build a Docker image.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It has a few more tricks up its sleeve, such as automatically installing RStudio for you when it detects that you are using R. Once the image has been built, a Docker container is created and executed, giving you access to the environment in which the repository author wanted the code to be executed. To achieve this, one needs access to two things: repo2docker and a docker daemon (they do not necessarily have to have docker installed on their local computer).&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://jupyterhub-team-compass.readthedocs.io/en/latest/team.html#jupyterhub-team"&gt;JupyterHub team&lt;/a&gt; just released &lt;a href="https://github.com/jupyter/repo2docker/blob/0.7.0/CHANGES.rst#version-070"&gt;v0.7 of repo2docker&lt;/a&gt;, so we decided to spend a bit of time explaining what it’s all about.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="An example repo2docker workflow. In this case, repo2docker is invoked locally. repo2docker is passed a URL to a git repository (). It then clones the repository, discovers configuration files in the repo (in this case, requirements.txt), builds a Docker image with this environment installed, and opens a local Jupyter server to explore and run the contents of the repo." src="https://jasongrout.github.io/medium-archive/pelican/posts/2018/introducing-repo2docker/images/002-1_lPmCcgJois-PygoFXI6Bhw.mp4" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;An example repo2docker workflow. In this case, repo2docker is invoked locally. repo2docker is passed a URL to a git repository (&lt;a href="https://github.com/norvig/pytudes"&gt;https://github.com/norvig/pytudes&lt;/a&gt;). It then clones the repository, discovers configuration files in the repo (in this case, &lt;code&gt;requirements.txt&lt;/code&gt;), builds a Docker image with this environment installed, and opens a local Jupyter server to explore and run the contents of the repo.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="the-guiding-principles-behind-repo2docker"&gt;The guiding principles behind repo2docker&lt;/h2&gt;
&lt;p&gt;repo2docker is meant to be as lightweight and common-sense as possible. The driving principles behind repo2docker are as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Leverage pre-existing workflows&lt;/strong&gt; in data science as much as possible. This means using standard configuration files (like &lt;code&gt;requirements.txt&lt;/code&gt;) instead of requiring people to learn new configuration patterns.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The shareable unit is a repository&lt;/strong&gt; or directory containing human-readable files. Not a single file (like a notebook) nor a binary blob (like a built docker image). This means that humans can inspect and extend other repositories meant for repo2docker, and that they can manually do what repo2docker does automatically. No black box.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Be workflow agnostic&lt;/strong&gt;. repo2docker supports many languages and user interfaces, it can run arbitrary shell scripts that are baked into the image, or it can trigger a script to be run each time a person runs the Docker image.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Be extensible and composable&lt;/strong&gt;. repo2docker should allow for multiple languages, tools, or workflows to be defined in a single GitHub repository. It should also be relatively easy to extend to support new use-cases.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Enable deterministic outputs&lt;/strong&gt;. We want repo2docker to make it possible for authors to generate the exact same environment from their repository every time, provided that they follow best-practices in computational methods (like providing specific version numbers for packages). repo2docker can build a specific commit, tag, or branch of a repository, which allows for an image to be deterministically built.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="how-can-repo2docker-be-used"&gt;How can repo2docker be used?&lt;/h2&gt;
&lt;p&gt;Over the last 18 months, we have been using repo2docker in production to automatically generate images that run repositories for &lt;a href="http://mybinder.org/"&gt;mybinder.org&lt;/a&gt;.&lt;br&gt;
It is used to build around 1000 unique repositories every week. The core functionality has proven itself and is considered production ready.&lt;/p&gt;
&lt;p&gt;Over the last year, we’ve seen a few major use-cases come out of repo2docker:&lt;/p&gt;
&lt;p&gt;First, it can be used as a &lt;strong&gt;part of production systems&lt;/strong&gt; like BinderHub. BinderHub automatically uses repo2docker to build images that run a user’s environment, and lets them share links that let others interact with the image.&lt;/p&gt;
&lt;p&gt;Second, repo2docker can be used to &lt;strong&gt;build an image for use with a JupyterHub&lt;/strong&gt;. For example, teachers have used repo2docker to convert their GitHub repository with course materials into a runnable Docker image that students access via a shared jupyterhub in the cloud.&lt;/p&gt;
&lt;p&gt;Finally, repo2docker has been used by individuals who wish to &lt;strong&gt;build reproducible images from their local work&lt;/strong&gt;. repo2docker can optionally run a Jupyter server from within the built image, which makes it possible to verify the results of analyses in an environment that was built solely from the configuration files present in the repository.&lt;/p&gt;
&lt;h2 id="what-next"&gt;What next?&lt;/h2&gt;
&lt;p&gt;We think that repo2docker serves as a useful tool for the community and that it is an important part of the large reproducible scientific software stack. It gives data scientists the benefits of containerization technology without needing to learn a new tool like Docker. It achieves this by being a lightweight command-line tool written in Python that automates the creation of the environment in which the authors of a piece of software wanted it to be executed.&lt;/p&gt;
&lt;p&gt;We’d love to see the repo2docker community grow, and for more&lt;br&gt;
languages, interfaces, use-cases, and workflows to be supported&lt;br&gt;
with &lt;a href="https://repo2docker.readthedocs.io/en/latest/architecture.html?highlight=build%20pack#buildpack"&gt;repo2docker’s build pack system&lt;/a&gt;. Let us know what you think!&lt;/p&gt;
&lt;p&gt;repo2docker is primarily maintained by the &lt;a href="https://jupyterhub-team-compass.readthedocs.io/en/latest/team.html"&gt;JupyterHub and Binder teams&lt;/a&gt;. If you’d like to get involved with the community or want to learn&lt;br&gt;
more about the tool, reach out! Check out these links for more information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/jupyter/repo2docker"&gt;repo2docker repository&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://repo2docker.readthedocs.io"&gt;repo2docker documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://discourse.jupyter.org"&gt;JupyterHub community forum&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gitter.im/jupyterhub/binder"&gt;Binder gitter channel&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/em&gt;*: some folks might be wondering why we developed repo2docker instead of contributing to a pre-existing containerization tool such as the excellent* &lt;a href="https://github.com/openshift/source-to-image"&gt;&lt;em&gt;source2image project&lt;/em&gt;&lt;/a&gt;&lt;em&gt;. We take the decision to create new open-source tech very seriously, and wrote a blog post about our decision to do-so in this case:&lt;/em&gt; &lt;a href="http://words.yuvi.in/post/why-not-s2i/"&gt;http://words.yuvi.in/post/why-not-s2i/&lt;/a&gt;&lt;/p&gt;
</content><category term="Docker"/><category term="GitHub"/></entry><entry><title>Binder 2.0, a Tech Guide</title><link href="https://jasongrout.github.io/medium-archive/pelican/posts/2017/binder-2-0-a-tech-guide-2017/" rel="alternate"/><published>2017-11-30T16:01:00+00:00</published><updated>2017-11-30T19:25:00+00:00</updated><author><name>Chris Holdgraf</name></author><id>tag:jasongrout.github.io,2017-11-30:/medium-archive/pelican/posts/2017/binder-2-0-a-tech-guide-2017/</id><summary type="html">&lt;p&gt;Authors: The Binder project is comprised of many individuals within and outside of the core Jupyter team. A list of members that…&lt;/p&gt;
</summary><content type="html">&lt;p&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2017/binder-2-0-a-tech-guide-2017/images/001-1_cWQj_YdmY_p14eh628N_Kg.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Authors: The Binder project is comprised of many individuals within and outside of the core Jupyter team. A list of members that contributed to this post is at the end of this article.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note: this post focuses more on technical changes in the Binder 2.0 reboot. For a post about user-facing features and future plans, see&lt;/em&gt; &lt;a href="https://elifesciences.org/labs/8653a61d"&gt;&lt;em&gt;this eLife blog post&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We are undergoing a dramatic increase in the complexity of techniques for analyzing data, doing scientific research, and sharing our work with others. In early 2016, the &lt;a href="https://mybinder.org"&gt;Binder project&lt;/a&gt; was announced, attempting to connect these three components. A &lt;a href="https://elifesciences.org/labs/a7d53a88/toward-publishing-reproducible-computation-with-binder"&gt;blogpost in eLife&lt;/a&gt; described a vision where scientists could specify dependencies along with a collection of Jupyter notebooks. Binder builds a Docker image from these dependencies, and provides a URL where any user in the world can instantly recreate this environment.&lt;/p&gt;
&lt;p&gt;Want to see it in action? Click the button below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://mybinder.org/v2/gh/wildtreetech/explore-open-data/binder20-elife?filepath=bikes-per-week.ipynb"&gt;&lt;img src="https://jasongrout.github.io/medium-archive/pelican/posts/2017/binder-2-0-a-tech-guide-2017/images/002-1_IA00K8fa8FvXedoBBDh2fg.webp" alt="" loading="lazy" data-body-image=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;With this post we are proud to announce the next version of Binder. It aims to be more modular, more flexible, more stable, faster, and more extensible than its predecessor. Powering this version of Binder is a collection of tools in the Jupyter ecosystem. Since being released, the Binder project has learned many things about implementing fast, flexible online deployments. In addition, its vision has expanded to include not only Jupyter notebooks, but many other computational workflows. You can access an open beta version of this deployment here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://mybinder.org"&gt;mybinder.org&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can find a list of sample repositories to learn how to create “Binder”-ready repositories here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/binder-examples"&gt;github.com/binder-examples&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can also see what the Binder community has been up to in creating their own repositories by checking the GitHub Binder topic:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;https://github.com/topics/binder
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Give it a shot, build some repositories, and importantly, tell us what could be improved on our &lt;a href="https://github.com/jupyterhub/binderhub"&gt;GitHub repo&lt;/a&gt;. Below we’ll describe a bit about what’s new.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="The new Binder UI. Users input a URL to a git repository (or specify a specific branch/tag/commit). Upon clicking “launch”, you will be directed to a live environment where you can interact with the code." src="https://jasongrout.github.io/medium-archive/pelican/posts/2017/binder-2-0-a-tech-guide-2017/images/003-1_lWcoBaRvNzXxzGPqV_3vew.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The new Binder UI. Users input a URL to a git repository (or specify a specific branch/tag/commit). Upon clicking “launch”, you will be directed to a live environment where you can interact with the code.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="whats-new"&gt;What’s new?&lt;/h2&gt;
&lt;p&gt;First off we’ll describe how the experience will change for users. The short answer is: not much. The goal of Binder is still enabling you to intantly create interactive and shareable repositories. We’ve completely rebuilt the backend of Binder, but we’ve made minimal changes to the front-end user experience.&lt;/p&gt;
&lt;p&gt;The biggest difference you should notice is that Binder is both faster and more stable. You’ll still be able to generate Binder links from a git URL from a single web-page. However, there are a few key differences:&lt;/p&gt;
&lt;h3 id="new-default-environment"&gt;New Default Environment&lt;/h3&gt;
&lt;p&gt;Old versions of Binder were based off of a Docker image that contained a fairly heavy computational environment. The new Binder deployment makes minimal assumptions about what environment you want installed, by default the only thing that will be installed is the Jupyter Notebook and Python 3. This means you’ll need to be more expressive in the dependencies you include in your dependency files. For example, if you want &lt;code&gt;numpy&lt;/code&gt; or &lt;code&gt;matplotlib&lt;/code&gt;, you should specify them in a &lt;code&gt;requirements.txt&lt;/code&gt; or &lt;code&gt;environment.yml&lt;/code&gt; file. Since you’re explicitly listing your requirements it makes reproducing your work more reliable, and allows the Binder infrastructure to change more freely without breaking your repository code.&lt;/p&gt;
&lt;h3 id="new-url-structure"&gt;New URL structure&lt;/h3&gt;
&lt;p&gt;The new URL structure for Binder follows the following convention:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;https://mybinder.org/v2/gh/&amp;lt;org-name&amp;gt;/&amp;lt;repo-name&amp;gt;/&amp;lt;branch|tag|hash-name&amp;gt;?filepath=&amp;lt;path-to-file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For example, below is the URL for a basic Binder-ready Python 3 repository, it includes basic information about the repository:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;https://mybinder.org/v2/gh/binder-examples/requirements/master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can also specify parameters that do things like point users to a particular file or initialize a user-interface. For example, the following URL starts JupyterLab once users click the link:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;https://mybinder.org/v2/gh/binder-examples/jupyterlab/master?urlpath=lab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In each case, note the &lt;code&gt;gh&lt;/code&gt; at the very beginning — this specifies that the git URL exists on github.com. It is possible to build new URL parsers for other online repositories such as BitBucket, osf.io, or any other provider. We are currently focusing on Git and GitHub, but nothing prevents Binder from being compatible with other kinds of content providers. Shortly before this blog post we added support for arbitrary git URLs to binderhub, so watch this space.&lt;/p&gt;
&lt;h3 id="specify-a-specific-branch-tag-commit"&gt;Specify a specific branch / tag / commit&lt;/h3&gt;
&lt;p&gt;Also notice that in the URL above you can specify a branch, tag, or commit hash for the Binder image. This allows you to ensure that a Binder image will &lt;strong&gt;always&lt;/strong&gt; remain the same (if you specify package versions properly). This is a crucial step for reproducibility and maintaining consistency in how users experience the files in your repository.&lt;/p&gt;
&lt;p&gt;Notice that in the URL above you can specify a commit hash or git tag for the Binder image. This hash is unique to the state of the code at the moment that the commit was made, ensuring that Binder can rebuild the exact same environment any time. Note that if authors don’t want to guarantee the same reproducible environment, they can specify a branch and BinderHub will resolve it to the latest commit hash before building the environment.&lt;/p&gt;
&lt;h3 id="binder-auto-building"&gt;Binder auto-building&lt;/h3&gt;
&lt;p&gt;When a git repository is launched, Binder will now check whether an image has already been built for that repository at the same commit hash. If it has, then Binder will skip the building process and take you straight to a JupyterHub instance that serves this image.&lt;/p&gt;
&lt;p&gt;If the image hasn’t been built, then it will automatically be generated before sending the user to JupyterHub. The only difference will be the amount of time it takes before entering the JupyterHub environment. This means that authors no longer need to explicitly build their Binder images when they update a branch. The next time someone clicks a Binder link, it will happen automatically. If you don’t want this behavior, be sure to point Binder to a specific tag or commit hash, rather than a branch name or tag. For example, here’s a Binder URL that will always point to the same commit hash:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;https://mybinder.org/v2/gh/wildtreetech/explore-open-data/binder20-elife
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;While this URL points to a branch, and will thus be re-built each time a new commit is made to that branch:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;https://mybinder.org/v2/gh/wildtreetech/explore-open-data/master
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id="more-options-for-dependency-files"&gt;More options for dependency files&lt;/h3&gt;
&lt;p&gt;Users often want to specify a computational environment that is more complex than a simple list of Python requirements. While this is possible by specifying a Dockerfile, it’s often an overly-complicated solution to this problem. Binder now uses &lt;a href="https://github.com/jupyter/repo2docker"&gt;repo2docker&lt;/a&gt; to build a Docker image from your repository. This makes it possible to specify a more complex environment with text files. For example, you can use an &lt;code&gt;apt.txt&lt;/code&gt; file to install packages with &lt;code&gt;apt-get&lt;/code&gt;, or use a file called &lt;code&gt;postBuild&lt;/code&gt; to define shell commands that are run before generating the Docker image (e.g. for downloading some data or running scripts). See the &lt;a href="https://repo2docker.readthedocs.io/en/latest/samples.html"&gt;repo2docker documentation&lt;/a&gt; for a list of files that are supported with Binder.&lt;/p&gt;
&lt;p&gt;For a selection of examples that show off how to specify dependencies take a look at the example gallery: &lt;a href="https://github.com/binder-examples"&gt;https://github.com/binder-examples&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="more-user-interfaces"&gt;More user interfaces&lt;/h3&gt;
&lt;figure&gt;
&lt;img alt="The JupyterLab interface running on Binder. You can access the JupyterLab demo repository at mybinder.org/v2/gh/binder-examples/jupyterlab/master?urlpath=lab" src="https://jasongrout.github.io/medium-archive/pelican/posts/2017/binder-2-0-a-tech-guide-2017/images/004-1_TW7Gnwl-02cejzgs1nnX2Q.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;The JupyterLab interface running on Binder. You can access the JupyterLab demo repository at ``mybinder&lt;code&gt;.org/v2/gh/binder-examples/jupyterlab/master?urlpath=lab&lt;/code&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;The previous iteration of Binder only supported the classic Jupyter Notebook user interface, while the new deployment will additionally support &lt;a href="https://github.com/binder-examples/dockerfile-rstudio"&gt;RStudio&lt;/a&gt; and &lt;a href="https://github.com/binder-examples/jupyterlab"&gt;JupyterLab&lt;/a&gt;. Because of the extra build configuration files specified above, you can also utilize more tools in the Jupyter widgets ecosystem, such as the &lt;a href="https://github.com/binder-examples/jupyter-rise"&gt;RISE plugin for interactive presentations&lt;/a&gt; or the &lt;a href="https://github.com/oschuett/appmode"&gt;appmode plugin&lt;/a&gt; to generate interactive apps from your repository. We also welcome contributions to add support for other user interfaces.&lt;/p&gt;
&lt;h3 id="more-online-repository-providers"&gt;More online repository providers&lt;/h3&gt;
&lt;p&gt;While GitHub is a fantastic repository of open-source code, it’s not the only repository. The new Binder deployment makes it straightforward to adding support for new sources of code (for example, GitLab, the OSF, or even non-git codebases). Currently GitHub is the only supported source for code, but we welcome contributions enabling support for new sources.&lt;/p&gt;
&lt;p&gt;We’re excited about this next step in Binder’s development, and hopeful that we can build a community around this powerful set of tools. Don’t hesitate to open an issue or pull request on our &lt;a href="https://github.com/jupyterhub/binderhub"&gt;GitHub repository&lt;/a&gt;, or to reach out via &lt;a href="https://gitter.im/jupyterhub/binder"&gt;our Gitter channel&lt;/a&gt;. We look forward to seeing what comes next, and to continue enabling reproducible and open workflows in data science and research.&lt;/p&gt;
&lt;h2 id="for-developers"&gt;For developers&lt;/h2&gt;
&lt;p&gt;The next few sections are meant for developers interested in deploying their own Binder, or for those interested in the technical details behind the new deployment.&lt;/p&gt;
&lt;h3 id="tech-components"&gt;Tech components&lt;/h3&gt;
&lt;p&gt;The three main technical components behind the new Binder backend are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://binderhub.readthedocs.io/"&gt;BinderHub&lt;/a&gt;, currently on display at &lt;a href="https://mybinder.org"&gt;mybinder.org&lt;/a&gt; and contained in the &lt;a href="https://github.com/jupyterhub/binderhub"&gt;binderhub repository&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://repo2docker.readthedocs.io/"&gt;repo2docker&lt;/a&gt;, a tool that converts a code repository into a Docker image with an environment specified via dependency files (e.g., &lt;code&gt;requirements.txt&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jupyterhub.readthedocs.io/en/latest/"&gt;JupyterHub&lt;/a&gt;, which hosts user instances with a server in the cloud. We use a distribution of JupyterHub that runs on top of Kubernetes.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more information on the infrastructure behind Binder, &lt;a href="https://binderhub.readthedocs.io/en/latest/"&gt;see the documentation&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;
&lt;img alt="A prototype of RStudio running in a Binder. This is currently support with a Dockerfile, and we are working on supporting R build files natively. You can access this repository at:" src="https://jasongrout.github.io/medium-archive/pelican/posts/2017/binder-2-0-a-tech-guide-2017/images/005-1_EgMk1PYMl6ouIP_XQ5G5Fg.webp" loading="lazy" data-body-image=""&gt;
&lt;figcaption&gt;A prototype of RStudio running in a Binder. This is currently support with a Dockerfile, and we are working on supporting R build files natively. You can access this repository at: &lt;code&gt;&amp;lt;https://mybinder.org/v2/gh/binder-examples/dockerfile-rstudio/master&amp;gt;&lt;/code&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h3 id="kubernetes"&gt;Kubernetes&lt;/h3&gt;
&lt;p&gt;Binder now also heavily relies on &lt;a href="https://kubernetes.io/"&gt;Kubernetes&lt;/a&gt; for scaling our image building service and the JupyterHub. Kubernetes is massively scalable and has a strong community of developers behind it. Moreover, Kubernetes is cloud-agnostic. It can be run on Google Cloud, Microsoft Azure, and AWS among others, as well as on your own bare metal hardware if needed. Because BinderHub is built to run on top of Kubernetes, you can deploy Binder off of any of these resources as well (see below).&lt;/p&gt;
&lt;h3 id="deploying-your-own-binder-server"&gt;Deploying your own Binder server&lt;/h3&gt;
&lt;p&gt;While mybinder.org will continue to exist as a public service, we hope to see new Binder deployments for many different use cases in the wild. One of our primary goals is to make it easier for users to deploy their own Binder servers. This is relatively straightforward by following the instructions on the &lt;a href="https://binderhub.readthedocs.io/en/latest/"&gt;BinderHub documentation&lt;/a&gt;, which are currently under active development to make ongoing improvements as the Kubernetes technology evolves. We’re continuously updating these steps to make them as clear as possible, so please don’t hesitate to open an issue or a pull request on our &lt;a href="https://github.com/jupyterhub/binderhub"&gt;github repository&lt;/a&gt; and make suggestions.&lt;/p&gt;
&lt;p&gt;We would love to see others deploy their own BinderHub servers, either for their own communities, or as part of a federated public service of BinderHubs.&lt;/p&gt;
&lt;h2 id="future-development"&gt;Future development&lt;/h2&gt;
&lt;p&gt;This is the just the beginning of new features and improvements to Binder. We’re working hard to grow an open-source community around these tools, and we encourage issues, comments, and PRs on the &lt;a href="https://github.com/jupyterhub/binderhub"&gt;BinderHub&lt;/a&gt;, &lt;a href="https://github.com/jupyter/repo2docker"&gt;repo2docker&lt;/a&gt;, and &lt;a href="https://github.com/jupyterhub/jupyterhub"&gt;JupyterHub&lt;/a&gt; repositories. We look forward to growing the Binder ecosystem, and we’re excited to see all of the Binders that people design.&lt;/p&gt;
&lt;h2 id="acknowledgements-alphabetical-order"&gt;Acknowledgements (alphabetical order)&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;C. Titus Brown (UC Davis), Matthias Bussonnier (UC Berkeley), Jessica Forde (UC Berkeley), Brian Granger (Cal Poly), Tim Head (Wild Tree Tech), Chris Holdgraf (UC Berkeley), Andrew Osheroff (Google), Naomi Penfold (eLife Sciences), M Pacer (UC Berkeley), Yuvi Panda (UC Berkeley), Fernando Perez (UC Berkeley), Min Ragan-Kelley (Simula Research Laboratory), and Carol Willing (Cal Poly). The Binder project is currently being funded from a grant from the Moore Foundation.&lt;/em&gt;&lt;/p&gt;
</content><category term="Binder"/><category term="Docker"/><category term="Kubernetes"/><category term="open science"/></entry></feed>