Skip to content

Instantly share code, notes, and snippets.

@abkfenris
Created July 25, 2014 23:45
Show Gist options
  • Save abkfenris/53c1dacca5fed296094e to your computer and use it in GitHub Desktop.
Save abkfenris/53c1dacca5fed296094e to your computer and use it in GitHub Desktop.
ipython with matplotlib dockerfile
FROM ipython/notebook
MAINTAINER Alex Kerney <[email protected]>
RUN apt-get install -y -q python-numpy python-scipy python-matplotlib python-pandas python-sympy python-nose
@rgbkrk
Copy link

rgbkrk commented Jul 26, 2014

To get around the first issue, I set the matplotlib backend.

import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')

To deal with the $DISPLAY issue, setting it to localhost:0 won't actually work. Right now it runs as root within the container.

What would you think about making the default user be student or ipynb. If people pull from the containers, they can always set up the user they want too.

@abkfenris
Copy link
Author

If I do %matplotlib inline instead of %matplotlib that works fine:

http://nbviewer.ipython.org/gist/abkfenris/672448d1c016e98b4115

This is also just docker run -d -p 8889:8888 notebook

@abkfenris
Copy link
Author

Just made a repo https://github.com/ipython/docker-notebook

What about changing the CMD to something like python notebook --no-browser --port 8888 --ip=* --pylab inline

@rgbkrk
Copy link

rgbkrk commented Jul 26, 2014

Ah, sure enough.

I definitely don't want the base ipython/notebook image to have pylab inline set. Willing to have an opinionated install that's easy to set up for students.

Any thoughts on how you would want the user of the notebook set up?

@abkfenris
Copy link
Author

And that was me not reading what I pasted, here's the repo: https://github.com/abkfenris/docker-ipython-matplotlib

I just changed the CMD and it will override the one from base.

What do you mean 'how you would want the user of the notebook set up?' On my own computer I've tweaked the CSS, I think in the default profile, but thats about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment