Dockerized Notebook for (Pythonic) Data Science
Docker container with Python data science tools (particularly, pandas, numpy, matplotlib, plotly, sklearn, scikit-image, nltk, gensim, psycopg2) the IPython notebook (single user). This is an autogenerated image using the public wise.io datascience git repo.
Quickstart the Notebook Server
Set a few environment variables locally (add later to
.bash_profile if you like):
export WISEDS_CODE_DIR="$(PWD)" # or wherever you want to code export WISEDS_DATA_DIR="$(PWD)/data" # likewise. export IPYTHON_PASSWORD=MakeAPassword # not this! alias wiseds="docker run -d -p 80:8888 -v $(PWD):/workspace/ -v $(PWD)/data:/workspace/data -e "PASSWORD=$IPYTHON_PASSWORD" wiseio/datascience-base ; echo 'Now go to your browser: http://$(docker-machine ip). The password is $IPYTHON_PASSWORD' "
Assuming you have docker installed, run this to start up a notebook server over HTTPS.
docker run -d -p 80:8888 -v $WISEDS_CODE_DIR:/workspace/ -v $WISEDS_DATA_DIR:/workspace/data -e "PASSWORD=$IPYTHON_PASSWORD" wiseio/datascience-base
You'll now be able to access your notebook at https://localhost with password MakeAPassword (please change the environment variable above).
If you are on OSX, you'll need to know the name of your VM from docker-machine:
You'll then connect via
Using the Container
Once you're running the container, you can get a terminal window inside if needed:
docker exec -it <container_name> bash
Here you can add new functionality if you need it. E.g.,
apt-get package-name pip install requirements.txt ...
Note that this will only add functionality into the container itself, not the image. If you want to use this new functionality, you'll want to add it to the image by hacking the Dockerfile.
Hacking on the Dockerfile
Clone the repository from whence this image was made, make changes then build the container:
git clone https://github.com/wiseio/datascience-docker.git cd datascience-docker docker build -t datascience-base . docker run -d -p 80:8888 -e "PASSWORD=$(IPYTHON_PASSWORD)" datascience-base
Use your own certificate
This image looks for
/key.pem. If it doesn't exist a self signed certificate will be made. If you would like to use your own certificate, concatenate your private and public key along with possible intermediate certificates in a pem file. The order should be (top to bottom): key, certificate, intermediate certificate.
cat hostname.key hostname.pub.cert intermidiate.cert > hostname.pem
Then you would mount this file to the docker container:
docker run -v /path/to/hostname.pem:/key.pem -d -p 443:8888 -e "PASSWORD=pass" wiseio/datascience-base
This docker image by default runs IPython notebook in HTTP. If you'd like to run this in HTTPS,
you can use the
USE_HTTP environment variable. Setting it to zero enables HTTPS.
docker run -d -p 443:8888 -e "PASSWORD=$IPYTHON_PASSWORD" -e "USE_HTTP=0" wiseio/datascience-base You'll then connect via https://<ip>`