Skip to content Skip to sidebar Skip to footer

How To Run A New Jupyter Notebook File That's Not Part Of A Pre-built Docker Image In Docker?

I am new to Docker. In order to take the Udacity Deep Learning course, I had to set up TensorFlow on my Windows machine using Docker. (Although TensorFlow is now available on Windo

Solution 1:

First of all, you need a way to get this Jupyter notebook (final project) on your Docker instance.

What is an easy way to copy a file inside of a Docker container? Well, not a lot.

  • We could attach a volume.
  • We could rewrite the Dockerfile to include the final project.
  • We could also enter in the Docker container and download the file.

I am going to detail the last one, but, don't forget that there are many solutions to one problem.

How do we enter in the Docker container?

docker exec -it [container-id] bash

How can we get the [container-id] ?

docker ps

It will show you a list of containers, match the one you want to enter in.

Once you're in your container. How can we download the file we want?

We should try to figure out if we have wget or curl utilities to download a file. If we don't, we have to install them from any package manager available (try apt-get, if it works, do: apt-get install wget).

Once we have something to download files from the Internet, we have to find out where the notebooks are stored. That is the difficult part.

Look for any folder which might contain, there could also be some kind of magic one liner to type using find, unfortunately, I am no magic wizard anymore.

Let's assume you are in the good folder.

wget https://raw.githubusercontent.com/udacity/machine-learning/master/projects/digit_recognition/digit_recognition.ipynb

That's all! Reload your page and you should see the notebook displayed.

Side-note: You might also need to install extra dependencies in the container.

Solution 2:

An alternative and much easier way is this:

  • Just start up your container like this: $ docker start -ai tensorflow-udacity
  • Then, click the upload button and locate the final project iPython Notebook file and upload it.

That's it. Whatever changes you make will be retained and you'll be able to see the new file in the container going forward!

enter image description here

Post a Comment for "How To Run A New Jupyter Notebook File That's Not Part Of A Pre-built Docker Image In Docker?"