Custom docker image, spawn fails on mybinder.org

I am trying to set up a binderhub notebook that has a package called octopus-code present.
The notebook at Binder fails to start.
It uses a dockerfile from iamashwin99/postopus-in-binder github repo which uses a docker image pushed to docker hub.
That docker file essentially is made from the docker file at github repo iamashwin99/postopus-in-container.

The build logs look like so :

Found built image, launching...
Launching server...
Server requested
2022-10-20T07:48:00.546793Z [Normal] Successfully assigned prod/jupyter-iamashwin99-2dpostopus-2din-2dbinder-2d901c3lgd to gke-prod-user-202201-0769dbf8-nclb
2022-10-20T07:48:01Z [Normal] Container image "jupyterhub/mybinder.org-tc-init:2020.12.4-0.dev.git.4289.h140cef5" already present on machine
2022-10-20T07:48:01Z [Normal] Created container tc-init
2022-10-20T07:48:01Z [Normal] Started container tc-init
2022-10-20T07:48:02Z [Normal] Pulling image "gcr.io/binderhub-288415/r2d-staging-g5b5b759-iamashwin99-2dpostopus-2din-2dbinder-8f81b1:0b0ad751d949cd85c4b0b2b70f06d2b011785ac9"
2022-10-20T07:49:02Z [Normal] Successfully pulled image "gcr.io/binderhub-288415/r2d-staging-g5b5b759-iamashwin99-2dpostopus-2din-2dbinder-8f81b1:0b0ad751d949cd85c4b0b2b70f06d2b011785ac9" in 1m0.150144749s
2022-10-20T07:49:02Z [Normal] Created container notebook
2022-10-20T07:49:02Z [Normal] Started container notebook
Spawn failed: pod prod/jupyter-iamashwin99-2dpostopus-2din-2dbinder-2d901c3lgd did not start in 300 seconds!
Launch attempt 1 failed, retrying...
Server requested
2022-10-20T07:52:41.188915Z [Normal] Successfully assigned prod/jupyter-iamashwin99-2dpostopus-2din-2dbinder-2d3bsum52y to gke-prod-user-202201-0769dbf8-jxwd
2022-10-20T07:52:42Z [Normal] Container image "jupyterhub/mybinder.org-tc-init:2020.12.4-0.dev.git.4289.h140cef5" already present on machine
2022-10-20T07:52:42Z [Normal] Created container tc-init
2022-10-20T07:52:42Z [Normal] Started container tc-init
2022-10-20T07:52:42Z [Normal] Pulling image "gcr.io/binderhub-288415/r2d-staging-g5b5b759-iamashwin99-2dpostopus-2din-2dbinder-8f81b1:0b0ad751d949cd85c4b0b2b70f06d2b011785ac9"
2022-10-20T07:53:37Z [Normal] Successfully pulled image "gcr.io/binderhub-288415/r2d-staging-g5b5b759-iamashwin99-2dpostopus-2din-2dbinder-8f81b1:0b0ad751d949cd85c4b0b2b70f06d2b011785ac9" in 54.906112635s
2022-10-20T07:53:37Z [Normal] Created container notebook
2022-10-20T07:53:38Z [Normal] Started container notebook
Spawn failed: Server at http://10.0.11.46:8888/user/iamashwin99-postopus-in-binder-3bsum52y/ didn't respond in 30 seconds
Launch attempt 2 failed, retrying...
Server requested
2022-10-20T07:54:21.580494Z [Normal] Successfully assigned prod/jupyter-iamashwin99-2dpostopus-2din-2dbinder-2dfijt7l1y to gke-prod-user-202201-0769dbf8-nclb
2022-10-20T07:54:22Z [Normal] Container image "jupyterhub/mybinder.org-tc-init:2020.12.4-0.dev.git.4289.h140cef5" already present on machine
2022-10-20T07:54:22Z [Normal] Created container tc-init
2022-10-20T07:54:23Z [Normal] Started container tc-init
2022-10-20T07:54:25Z [Normal] Container image "gcr.io/binderhub-288415/r2d-staging-g5b5b759-iamashwin99-2dpostopus-2din-2dbinder-8f81b1:0b0ad751d949cd85c4b0b2b70f06d2b011785ac9" already present on machine
2022-10-20T07:54:25Z [Normal] Created container notebook
2022-10-20T07:54:25Z [Normal] Started container notebook
Spawn failed: Timeout
Launch attempt 3 failed, retrying...
Server requested
2022-10-20T07:59:37.879111Z [Normal] Successfully assigned prod/jupyter-iamashwin99-2dpostopus-2din-2dbinder-2devau5ukh to gke-prod-user-202201-0769dbf8-nclb
2022-10-20T07:59:42Z [Normal] Container image "jupyterhub/mybinder.org-tc-init:2020.12.4-0.dev.git.4289.h140cef5" already present on machine
2022-10-20T07:59:42Z [Normal] Created container tc-init
2022-10-20T07:59:43Z [Normal] Started container tc-init
2022-10-20T07:59:43Z [Normal] Container image "gcr.io/binderhub-288415/r2d-staging-g5b5b759-iamashwin99-2dpostopus-2din-2dbinder-8f81b1:0b0ad751d949cd85c4b0b2b70f06d2b011785ac9" already present on machine
2022-10-20T07:59:43Z [Normal] Created container notebook
2022-10-20T07:59:43Z [Normal] Started container notebook
Spawn failed: Timeout
Spawn failed: Timeout

Im not sure what I’m doing wrong to get it working.

Have you stepped through the guide Use a Dockerfile for your Binder repository?

Just a little inspection of the Dockerfile in your repo raises mismatches with the directions.

" When sourcing a pre-existing Docker image with FROM , a tag is required . The tag cannot be latest ."

Your FROM line clearly doesn’t adhere to that:

FROM iamashwin99/postopus-tmp:latest

Then you seem to adhere to some of the other blocks you need but not others there? For example, I don’t see anything like this in your Dockerfile:

ARG NB_USER=jovyan
ARG NB_UID=1000

And it doesn’t end with:

RUN chown -R ${NB_UID} ${HOME}
USER ${NB_USER}

Maybe you are basing it on some other one that works? If so, link to it. Or better yet, adapt it to yours.


You probably should heed the initial advice on the guide Use a Dockerfile for your Binder repository:

" Before resorting to a Dockerfile, we recommend trying to use postBuild commands for configuration"

You can use apt.txt to cover anything you cannot do with environment.yml alone.

Maybe you already did try?

This approach has a big advantage in that you wouldn’t need a separate repo from iamashwin99/postopus-in-container. You can put a binder directory in the root of that repo and then put configuration files in there. They will get used by mybinder instead of the Dockerfile in root.

1 Like

Thank you very much for your kind reply,
I tried FROM iamashwin99/postopus-tmp:f9ed62bd5b9022e1 but got an error on the mybinder page saying manifest unknown. I now explicitly added the tag test and added the correct userid and CHOWN commands, and I still have the same error.

2022-10-20T18:09:27Z [Normal] Container image "gesiscss/binder-r2d-g5b5b759-iamashwin99-2dpostopus-2din-2dbinder-8f81b1:f984e33c3e9b88c16213608dd6ec07b189cb0cb9" already present on machine
2022-10-20T18:09:27Z [Normal] Created container notebook
2022-10-20T18:09:28Z [Normal] Started container notebook
Spawn failed: Timeout
Launch attempt 1 failed, retrying...
Server requested
2022-10-20T18:14:07Z [Normal] Successfully assigned bhub-ns/jupyter-iamashwin99-2dpostopus-2din-2dbinder-2dsu5g4dn0 to svko-ilcm04
2022-10-20T18:13:26Z [Normal] Created container block-cloud-metadata
2022-10-20T18:13:27Z [Normal] Started container block-cloud-metadata
2022-10-20T18:14:07Z [Normal] Successfully assigned bhub-ns/jupyter-iamashwin99-2dpostopus-2din-2dbinder-2dsu5g4dn0 to svko-ilcm04
2022-10-20T18:14:07Z [Normal] Successfully assigned bhub-ns/jupyter-iamashwin99-2dpostopus-2din-2dbinder-2dsu5g4dn0 to svko-ilcm04
2022-10-20T18:16:05Z [Normal] Successfully pulled image "gesiscss/binder-r2d-g5b5b759-iamashwin99-2dpostopus-2din-2dbinder-8f81b1:f984e33c3e9b88c16213608dd6ec07b189cb0cb9" in 2m37.81827955s
2022-10-20T18:16:07Z [Normal] Created container notebook
2022-10-20T18:16:07Z [Normal] Started container notebook
Spawn failed: pod bhub-ns/jupyter-iamashwin99-2dpostopus-2din-2dbinder-2dsu5g4dn0 did not start in 300 seconds!
Launch attempt 2 failed, retrying...
Server requested

The reason we want the dockerfile is that we are compiling the octopus code from scratch and this takes about 20 mins to an hour, depending on the machine used. It is thus not sensible having to wait for that long for binder to load (if at all it waits that long)

You’ve checked out the stuff about ENTRYPOINT and built and tested your image locally following the bottom of the guide? Verified your user has an id of 1000 and ownership of files in the home folder?

Another approach is to get octopus-code built for conda-forge. While the dependency tree is non-trivial, the fact they they have such a file (and docs) suggests it might be doable.

This would be rather an undertaking, of course, but the net result would be something that any binder could use with a single line in an environment.yml, which helps replicability (not just reproducibility)… docker is a big rug under which to sweep these things. The net time on binder build would of course be higher, as the mamba solver would still have to pick apart all those dependencies.

1 Like

Thanks for all the suggestions,
I tried running the image locally and found that for some reason, the jupyter binary was not in path (even though its in the path when you run it on a bash login shell).
I added the line ENV PATH="${HOME}/.local/bin:${PATH}" to solve it.

1 Like

Thanks for posting about the tricky hurdle after you cleared it. Hopefully that helps someone else.