Proxying dockerised services (Docker in Binder)

Several examples in the Binder examples repo and elsewhere demonstrate how to install and start notebook proxied services (for example, openrefineder, or the RStudio or stencila proxies).

Is there an example anywhere showing how to start and proxy a dockerised service within a Binder container?

For example, if I wanted to make use of something like I’d need access to an Apache Tika service. Building such a service might be painful, but running a pre-built Tika container inside the Binder container would be much easier?

This also makes me wonder: repo2docker will build from my own Dockerfile in MyBinder, so could it also build from a docker-compose.yaml file? Or will that run the risk of spawning too many containers? Could I run docker-compose inside the Binder container?

1 Like

Extensions that subclass the nbserverproxy extension typically just specify the commands that starts their services, a network port if necessary, and optionally some environment. I don’t know if binder permits docker containers to run inside the singleuser container, but if it does you would need to define the command that launches the container. See the get_cmd method of the extensions you mentioned.

def get_cmd(self):
    return ["docker", "run", "more", "stuff", ...]

I’ve been thinking that nbserverproxy should be able to get some configuration such that we should be able to write a config file instead of creating too many subclass packages. I think that would be pretty useful.

1 Like

One of the things I noticed while tinkering w/ @betatim’s OpenRefineder (issue) was there was no obvious way to find a dynamically assigned proxy port number, which would have been helpful (although is maybe difficult!)?