Skip to content

Lightweight container environment with Cuda, Miniconda3, and Jupyter Lab.

License

Notifications You must be signed in to change notification settings

TtheBC01/CudaConda3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CUDA Enabled Jupyter Lab Environment with Miniconda3

This repository creates a docker image for serving python notebooks from a container hosted on a GPU-accelerated machine (which is itself behind a reverse proxy). See Cloud-in-a-Box for a complete deployment stack with authentication and resource monitoring.

Out-of-the box notebook support:

WARNING: The entrypoint.sh script disables the native token-based authentication in the Jupyter Lab application since the resulting base image is intended to be hosted behind a reverse proxy application with its own authentication and authorization flow.

Pre-built Docker Image

A version of cudaconda3 is available on docker hub pre-built for CUDA 12.2.0 and Python 3.10:

docker pull tthebc01/cudaconda3

Building Locally

To build a local image and run with a local directory mounted in the container, do this:

git clone https://github.com/TtheBC01/CudaConda3.git
cd CudaConda3
docker build -t cudaconda3 .
docker run --name cudaconda --rm -p 8888:8888 -d --gpus all -v ~/path/to/project:/root/project cudaconda3

You should be able to access the Jupyter Lab application from your browser now by going to http://localhost:8888/jupyter/lab.

Changing Conda or Cuda versions

For proper operation, the cudaconda3 base image must match the CUDA version on the host machine. First, check the version of CUDA installed on the host machine you will be running the container on:

nvidia-smi

Next, the Dockerfile is configured with two optional build arguments:

  • MINCONDA: Default is Miniconda3-py310_23.3.1-0-Linux-x86_64.sh, see the Miniconda installer page for more options (you'll need to use a Linux installer though)
  • CUDATAG: Default is 12.2.0-devel-ubuntu20.04 Docker Hub repository for more options (stick to Debian based tags)

Therefore, you can customize the build for your needs with a command like the following:

docker build --build-arg MINICONDA=Miniconda3-py37_4.12.0-Linux-x86_64.sh --build-arg CUDATAG=11.7.0-runtime-ubuntu20.04 -t cudaconda .

Adding PyTorch to Your Lab Environment

See the PyTorch installation guide for commands to install your target version of the package.

For example, installation with CUDA 12.4 will look something like this:

python -m pip install torch torchvision torchaudio