Setup docker for Kaggle

Why use docker for Kaggle

CPU-only image

docker pull kaggle/python
kjupyter() {
docker run -v $PWD:/tmp/working -w=/tmp/working -p 8888:8888 --rm -it kaggle/python bash -c "pip install jupyter_contrib_nbextensions; pip install jupyter_nbextensions_configurator; jupyter contrib nbextension install --user; jupyter notebook --notebook-dir=/tmp/working --ip='*' --port=8888 --no-browser --allow-root"
}
pip install jupyter_contrib_nbextensions; pip install jupyter_nbextensions_configurator; jupyter contrib nbextension install --user;

GPU image

git clone https://github.com/Kaggle/docker-python.git
kjupyter() {
docker run --runtime=nvidia -v $PWD:/tmp/working -v /data:/tmp/working/data -w=/tmp/working -p 8888:8888 --rm -it kaggle/python-gpu-build bash -c "export LD_LIBRARY_PATH=/usr/local/cuda/lib64; pip install jupyter_contrib_nbextensions; pip install jupyter_nbextensions_configurator; jupyter contrib nbextension install --user; jupyter notebook --notebook-dir=/tmp/working --ip='*' --port=8888 --no-browser --allow-root"
}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
kjupyter() {    docker run --runtime=nvidia -v $PWD:/tmp/working -v /data:/tmp/working/data -w=/tmp/working -p 8888:8888 — rm -it kaggle/python-gpu-build bash -c “export LD_LIBRARY_PATH=/usr/local/cuda/lib64; pip install jupyter_contrib_nbextensions; pip install jupyter_nbextensions_configurator; jupyter contrib nbextension instal --user; jupyter nbextension enable toc2/main --user; jupyter notebook — notebook-dir=/tmp/working — ip=’*’ — port=8888 — no-browser — allow-root”}
kjupyter() {
docker run --runtime=nvidia -v $PWD:/tmp/working -v /data:/tmp/working/data -w=/tmp/working -p 8888:8888 --rm -it kaggle/python-gpu-build bash -c "pip install tornado==4.5.3; export LD_LIBRARY_PATH=/usr/local/cuda/lib64; pip install jupyter_contrib_nbextensions; pip install jupyter_nbextensions_configurator; jupyter contrib nbextension install --user; jupyter nbextension enable toc2/main --user; jupyter notebook --notebook-dir=/tmp/working --ip='*' --port=8888 --no-browser --allow-root"
}

--

--

Software Engineering SMTS at Salesforce Commerce Cloud Einstein

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store