Repo2docker: Starting from image

Created on 19 Oct 2018  路  5Comments  路  Source: jupyterhub/repo2docker

Hi,
I'm new in docker and do not understand how to start a docker from a previously obtained image.
When I run the jupyter-repo2docker, it creates an image. If for any reason I stop or kill the container, I have to rerun the jupyter-repo2docker again and go through the whole process of downloading and installing all the stuffs? I already have all this in the image, it should be possible to just "boot on it", no?
Sorry for the noise if I'm not even asking at the right place...
Christophe

user-support

Most helpful comment

Welcome! You have the right idea, you can reuse the image once you've built it. If we could find some good tutorials/introduction do basics of docker pages to link to that would be a good addition to the documentation. Unfortunately it has been so long since I Learnt the basics that I don't have any good starting links. From a bit of googling and reading https://docker-curriculum.com/#hello-world looks like it might be good. Most tutorials are too focussed on the "devops" angle which isn't so relevant here (I think).

Here a small guide:

# run repo2docker for the first time
$ repo2docker https://github.com/binder-examples/requirements
# after exiting list the images you have
$ docker images
REPOSITORY                                                                                            TAG                 IMAGE ID            CREATED              SIZE
r2dhttps-3a-2f-2fgithub-2ecom-2fbinder-2dexamples-2frequirements1539982642                            latest              0a873cdc0951        About a minute ago   1.64GB
# there might be more but one should have a name similar to the URL you use
# to run the image
$ docker run -p 12345:8888 r2dhttps-3a-2f-2fgithub-2ecom-2fbinder-2dexamples-2frequirements1539982642 jupyter notebook --ip 0.0.0.0 --NotebookApp.custom_display_url=http://127.0.0.1:12345

This makes me wonder if we should have a built in command in repo2docker for this?

All 5 comments

Hey Christophe - I'd recommend checking out the Docker documentation about the various terminology of things. repo2docker is mostly for building images and then adding them to a Docker registry so you can deploy those images at will. The process of keeping track of / maintaining / re-using your images is a bit out-of-scope for this project. I think the broader Docker community can help with getting you started!

Thanks a lot.
Well, after some googlings and try/error, I found the way to start a container using an image created with repo2docker:

docker run -d -p 56789:56789 -v $HOME/data_dock1:$HOME/data $IMAGE_ID jupyter notebook --ip 0.0.0.0 --port 56789 --NotebookApp.custom_display_url=http://127.0.0.1:56789 --NotebookApp.token='12345'

If one prefer the system to deliver a huge token, omit the last keyword and one obtain the token after running the container by:
docker exec -it $CONTAINER_ID jupyter notebook list

Welcome! You have the right idea, you can reuse the image once you've built it. If we could find some good tutorials/introduction do basics of docker pages to link to that would be a good addition to the documentation. Unfortunately it has been so long since I Learnt the basics that I don't have any good starting links. From a bit of googling and reading https://docker-curriculum.com/#hello-world looks like it might be good. Most tutorials are too focussed on the "devops" angle which isn't so relevant here (I think).

Here a small guide:

# run repo2docker for the first time
$ repo2docker https://github.com/binder-examples/requirements
# after exiting list the images you have
$ docker images
REPOSITORY                                                                                            TAG                 IMAGE ID            CREATED              SIZE
r2dhttps-3a-2f-2fgithub-2ecom-2fbinder-2dexamples-2frequirements1539982642                            latest              0a873cdc0951        About a minute ago   1.64GB
# there might be more but one should have a name similar to the URL you use
# to run the image
$ docker run -p 12345:8888 r2dhttps-3a-2f-2fgithub-2ecom-2fbinder-2dexamples-2frequirements1539982642 jupyter notebook --ip 0.0.0.0 --NotebookApp.custom_display_url=http://127.0.0.1:12345

This makes me wonder if we should have a built in command in repo2docker for this?

Great, thanks a lot! And you're right, it seems that there is no simple and clear introduction to docker's world...
Now the point is that using the save/load image from docker seems to produce an image that is not runable on the other machine. But this is another story.

Is there anything more to do here, @Morisset! Can we close this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trallard picture trallard  路  4Comments

choldgraf picture choldgraf  路  4Comments

consideRatio picture consideRatio  路  6Comments

betatim picture betatim  路  6Comments

yuvipanda picture yuvipanda  路  5Comments