Ready to run jupyter notebook in docker, with Python 3.6, OpenCV 3.3, OpenCV contrib, and some recommended python libraries for data science (numpy, pandas, sklearn, etc).
-
Install Docker CE - for Mac, for Windows or for Ubuntu
-
Run this command from your project directory:
docker run --interactive --tty --init --rm --name opencv-notebook --publish 8888:8888 --volume `pwd`/data:/app/data alexlouden/python-opencv-notebook
The
data
directory will be created, shared with the docker container, and the jupyter notebook will be launched from here.Run Control + C to shut down the notebooks and stop the docker container.
Parameter explanation:
--interactive
- runs in foreground (will run in the background without)--tty
- runs a psudo TTY (for shell interaction, shell colours, Control + C)--init
- runs using tini to reap zombies--rm
- container is removed after exit. As long as you keep everything indata
you won't lose anything. If you don't pass this argument then after the container is stopped you can rundocker start -i opencv-notebook
to restart it, ordocker rm opencv-notebook
to remove it.--name
- name the docker container--publish
- choose which ports to expose from the docker container to host--volume
- bind a volume, used to share data between container and host (must be an absolute path - I've usedpwd
)
See docker docs for more info.
-
You should see the following output:
Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://localhost:8888/?token=longsecrettoken
Open the URL in your browser, and you should get access!
- Aims to be a lot simpler and easier to understand than https://github.com/jupyter/docker-stacks
- Uses the
python 3.6.3
base docker image - Uses
pip
rather thanconda
(installs fromrequirements.txt
) - No virtualenv - uses the docker container's system Python
- Designed to run on your computer (not a public server) - no SSL, no password, runs as root docker user.
You can clone this repo and build the image yourself with:
git clone git@github.com:alexlouden/python-opencv-notebook.git
cd python-opencv-notebook
docker build -t python-opencv-notebook .