3

I need to install additional software in a Google datalab container that runs with docker. It is possible to run bash commands with %%bash .... However, this does not allow interactivity. So, I need an interactive shell within the container.

Soerendip
  • 7,684
  • 15
  • 61
  • 128

2 Answers2

2

If you need to modify the Datalab image you can write a new Dockerfile based on it like @Rambler suggested, or you can fork your own version, Datalab is open source.

yelsayed
  • 5,236
  • 3
  • 27
  • 38
1

You can try running the container in interactive mode in the following way :

docker run -it --name=<container_name> <image>:<tag> /bin/bash

If the container is already running , you can leverage docker exec :

docker exec -it <container_name> /bin/bash
Rambler
  • 4,994
  • 2
  • 20
  • 27
  • It works, but it seems that when I do that the changes are not permanent. Here is some info: http://www.ifconfig.it/wordpress/2015/05/docker-installsw/ – Soerendip Nov 15 '16 at 11:23
  • Yeah , you would have to commit the container after your changes to retain them.Instead you can also write a Dockerfile with the install commands for required software and then generate an updated image.Here the datalab's image will be the base image. – Rambler Nov 15 '16 at 11:31
  • It also seems that changes are not made in the running container, because the file system stays the same when I look at it from the jupyter notebook that runs in the cloud. – Soerendip Nov 15 '16 at 11:41
  • Weird.You can just run a simple test , for ex. , just create a file in a running container, commit it , and then re run it.That file should be present there. – Rambler Nov 15 '16 at 11:55
  • It is really weird. To access the notebook I have to start the docker container. I can access the container and I see the changes in the file system. But when I use the jupyter notebook the filesystem looks unchanged!?! – Soerendip Nov 15 '16 at 12:16
  • Can you share more details? What commands are you running? Are you saying if you ssh into the running container and create a directory under the Jupyter notebook root, the file browser still can't see it? – yelsayed Nov 15 '16 at 18:13