This is a docker image of a modified version of Python 3.9 that supports running without the global interpreter lock (GIL). See https://github.com/colesbury/nogil.
This image includes CUDA. If you do not need CUDA, use https://hub.docker.com/r/colesbury/python-nogil.
The images is based on NVIDIA's CUDA 11.0 Ubuntu 20.04 image (nvidia/cuda:11.0-devel-ubuntu20.04)
Dockerfile in your Python app projectFROM colesbury/python-nogil-cuda
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./your-daemon-or-script.py" ]
You can then build and run the Docker image:
$ docker build -t my-python-app .
$ docker run --gpus all -it --rm --name my-running-app my-python-app
For many simple, single file projects, you may find it inconvenient to write a complete Dockerfile. In such cases, you can run a Python script by using the Python Docker image directly:
$ docker run --gpus all -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp colesbury/python-nogil-cuda python your-daemon-or-script.py
This container is built of the NVIDIA CUDA image, which is governed by the the NVIDIA's deep learning container license.
This software contains source code provided by NVIDIA Corporation.
View license information for Python 3. This Readme is modified from the official Python image documentation under an MIT license.
Content type
Image
Digest
Size
2 GB
Last updated
over 4 years ago
docker pull colesbury/python-nogil-cuda