Kaggle/docker-python: the image behind Kaggle Notebooks
Kaggle Python docker image
At a glance
- What is it?
- Kaggle/docker-python is the Dockerfile and build tooling that produce the CPU, GPU and TPU images Kaggle Notebooks run on. It is a contribution target for people who need a package added to Kaggle, not a general-purpose Python base image.
- Who is it for?
- Adopt this repository if you are adding a package to Kaggle Notebooks or reproducing that environment locally; skip it if you want a small Python base image, since the CPU image is published at gcr.io/kaggle-images/python and the GPU one at gcr.io/kaggle-gpu-images/python. Before opening a pull request, check whether installing the package yourself in a notebook already covers your case and confirm your change lands in kaggle_requirements.txt with a test under tests/.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 6 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.
Star history
- Kaggle/docker-python2,745 ★ · +2
| Repository | 2026-10-04 | 2026-11-23 |
|---|---|---|
| Kaggle/docker-python | 2.7k | 2.7k |
2 Stars in the last 50 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The environment Kaggle Notebooks run in, shipped as a Dockerfile
Kaggle Notebooks let users run a Python notebook in the cloud against competitions and datasets without downloading data or setting up an environment. That promise only holds if every notebook starts from the same set of libraries, at the same versions, on the same base system. Kaggle/docker-python is the repository that produces that environment: it holds the Dockerfile used to build the CPU-only and GPU images, plus the scripts that build, test and push them. The audience is narrow and specific. It is for Kaggle engineers and for outside contributors who want a package added to the platform, and for users who want to run the same environment on their own machine. It is not a starter image for a web service. Nothing in the README positions it that way, and the published images are large by design because they carry a data science stack rather than a runtime.
How the build, requirements and test scripts fit together
The repository is a build pipeline rather than an application. Dockerfile.tmpl is a template, and there is a renderizer/ directory, so the final Dockerfile is generated from that template rather than edited directly. Package additions go into kaggle_requirements.txt, which the README names as the first step of a pull request. The build script produces an image; the test script exercises it against the suite in tests/. A Jenkinsfile sits at the top level, which points to CI driving the same scripts rather than a separate pipeline definition. There are also patches/, clean-layer.sh, a diff script and a push script, all consistent with a workflow where images are rebuilt, compared and published to the Google Container Registry. The README states the images are stored at gcr.io/kaggle-images/python for CPU-only and gcr.io/kaggle-gpu-images/python for GPU. A tpu/ directory exists alongside the CPU and GPU paths, matching the three release tracks visible in the repository's releases.
Running the prebuilt Kaggle image locally
You do not need to build anything to use the environment. The README gives two ways to start a container: run an image you built locally, or pull the prebuilt one from gcr.io. For the CPU image, the documented commands are a local run against kaggle/python-build and a registry run against gcr.io/kaggle-images/python. Both open an interactive bash shell with --rm -it, so the container is discarded when you exit. Expect a shell prompt inside the container, not a notebook server; nothing in the README starts Jupyter for you.
# Run the image built locally:
docker run --rm -it kaggle/python-build /bin/bash
# Run the pre-built image from gcr.io
docker run --rm -it gcr.io/kaggle-images/python /bin/bashThe GPU path differs in one flag. The README uses --runtime nvidia and the kaggle-gpu-build image name for local builds, and gcr.io/kaggle-gpu-images/python for the registry image. It also links to a GitHub issue comment for instructions on making the container see the GPU, which means the runtime flag alone is not presented as sufficient.
# Run the image built locally:
docker run --runtime nvidia --rm -it kaggle/python-gpu-build /bin/bash
# Run the image pre-built from gcr.io
docker run --runtime nvidia --rm -it gcr.io/kaggle-gpu-images/python /bin/bashIf you want to build instead of pull, the README documents a single script with two flags: --gpu for a GPU image and --use-cache for faster iterative builds.
./buildAfter a build, the README points at ./test, which accepts --gpu, --pattern (or -p) to run one test file, and --image (or -i) to test a specific image tag. The example tag given for the latter is gcr.io/kaggle-images/python:ci-pretest.
Adding a package is a pull request against kaggle_requirements.txt
The README is explicit that installing the package yourself in your own notebook is the first thing to evaluate, and it links to a wiki page on missing packages for that. Only if that does not work should you open an issue or a pull request. The contribution path is ordered: edit kaggle_requirements.txt, build a new image, add a test for the new package following the linked test_fastai.py example, test the new image, then open the PR. That ordering is the real constraint. A requirement line without a test is an incomplete change by the project's own instructions, and the test suite is the mechanism that keeps the image from silently losing an import. There is no documented path for pinning a package that conflicts with something already in the image, and the README does not describe how dependency conflicts between requested packages are resolved.
Where this image is the wrong tool
The image is built to contain a large, fixed data science stack, and that is the opposite of what most Python container users want. If you are shipping a service, a gcr.io/kaggle-images/python base brings in far more than your application needs, and the README offers no slim variant or size guidance. There is no documented multi-stage build recipe here either. The build flags are limited to --gpu and --use-cache, so there is no documented way to produce a trimmed image from this repository. The README also does not document rollback, image retention or how long a given tag stays available on gcr.io, which matters if you pin a tag in a CI job. Finally, the GPU instructions lean on an external issue comment for enabling GPU access, so the container runtime setup is not self-contained in the README.
Compared with a general Python base image
The obvious alternative is the official python image on Docker Hub, or one of its slim variants. The difference is scope, not quality. A python base image gives you an interpreter, pip and a minimal OS layer, and you install exactly what your project needs; the Kaggle image gives you the interpreter plus the library set Kaggle Notebooks expose, so that a notebook written on Kaggle behaves the same in your container. That is why the Kaggle image is worth pulling when you are debugging a notebook outside the platform, and why it is the wrong starting point when you are building an application whose dependency list you control. The repository also has a dev.Dockerfile at the top level, which suggests a separate development image is maintained alongside the published CPU and GPU ones, though the README does not describe it.
Maintenance, licensing and what a release tag means
The repository is not archived, and the last push was on 2026-09-05. Releases are cut per hardware track: v170 was published on 2026-06-29 in three variants, CPU, GPU and TPU, each with a long hash in the tag name. If you pin an image, pin the full tag rather than a floating one, because the hash is what distinguishes one build of v170 from another. The upgrade cost for a contributor is the build and test cycle described above; for a user it is a pull of a new tag. The repository is licensed under Apache-2.0, and the LICENSE file is at the top level. That covers the repository contents. It does not tell you the licence terms of every package baked into the resulting image, and the README does not list them, so if you redistribute the image you need to check the bundled packages yourself. Nothing here is legal advice.
Editorial conclusion
Adopt this repository if you are adding a package to Kaggle Notebooks or reproducing that environment locally; skip it if you want a small Python base image, since the CPU image is published at gcr.io/kaggle-images/python and the GPU one at gcr.io/kaggle-gpu-images/python. Before opening a pull request, check whether installing the package yourself in a notebook already covers your case and confirm your change lands in kaggle_requirements.txt with a test under tests/.
Frequently asked questions
Can I run Python on Docker with the Kaggle image?
Yes. The README documents running the prebuilt CPU image with docker run --rm -it gcr.io/kaggle-images/python /bin/bash, which drops you into a bash shell with the Kaggle Python environment available.
How do I install a package into the Kaggle/docker-python image?
The README says to first evaluate whether installing the package yourself in your own notebook suits your needs, and only then open an issue or pull request. A pull request adds the package to kaggle_requirements.txt, builds and tests a new image, and includes a test for the new package.
What is the difference between the Kaggle CPU and GPU images?
They are separate builds published to different registries: the CPU-only image is at gcr.io/kaggle-images/python and the GPU image is at gcr.io/kaggle-gpu-images/python. The README runs the GPU container with --runtime nvidia and links to a GitHub issue comment for making the container see the GPU.
Which command builds a Kaggle/docker-python image locally?
The README documents ./build, with --gpu to build a GPU image and --use-cache for faster iterative builds. Local images are named kaggle/python-build and, for the GPU variant, kaggle/python-gpu-build.
How do I run the Kaggle/docker-python test suite?
The README documents ./test, with --gpu to test the GPU image, --pattern (or -p) to run a single test such as test_keras.py, and --image (or -i) to test a specific image such as gcr.io/kaggle-images/python:ci-pretest.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/kaggle-docker-python)Star history chart for your README
[](https://hysenlabs.com/projects/kaggle-docker-python)Was this useful?