Pixi Docker Images
The officialpixi-docker repository provides Docker images with Pixi pre-installed on various base images.
Available Images
Images are available at ghcr.io/prefix-dev/pixi:latest- Ubuntu Jammy (22.04)focal- Ubuntu Focal (20.04)bullseye- Debian Bullseyenoble-cuda-12.9.1- Ubuntu 24.04 with CUDA 12.9.1noble-cuda-13.0.0- Ubuntu 24.04 with CUDA 13.0.0- …and more
For all available tags, see the build script.
Best Practices Blog Post
Learn best practices for shipping conda environments to production using Pixi and Docker
Multi-Stage Dockerfile Example
This example demonstrates a production-ready multi-stage build that usespixi shell-hook to avoid including Pixi in the final image:
Dockerfile
For more examples, see pavelzw/pixi-docker-example.
Advanced Docker Setup
This example demonstrates using solve-groups and per-environment editability for optimal development and production workflows.Project Structure
pyproject.toml
Multi-Stage Production Dockerfile
Dockerfile
Docker Compose for Development
docker-compose.yml
Usage Commands
Development with Docker Compose
Key Concepts
Shell Hook
Thepixi shell-hook command generates shell code to activate the environment without requiring Pixi:
Solve Groups
Solve groups ensure that different environments (dev/prod) use identical dependency versions:Environment Editability
- Development: Use
editable = truefor fast iteration without rebuilds - Production: Use
editable = falsefor a clean, optimized installation
Best Practices
Multi-Stage Builds
Use multi-stage builds to minimize final image size by excluding build tools and Pixi itself.
Lock Files
Always use
--locked flag to ensure reproducible builds with exact dependency versions.Layer Caching
Copy
pixi.toml and pixi.lock before source code to leverage Docker’s layer caching.Path Consistency
Keep the environment path identical between build and runtime stages for proper activation.
Minimal Base Images
Use minimal base images like Ubuntu or Debian for smaller final image sizes.
Troubleshooting
Environment Not Activating
Ensure the prefix path remains the same between build and runtime:Missing Dependencies
Verify all runtime dependencies are in the production environment, not just development:Large Image Size
Use multi-stage builds and avoid including:- Pixi binary in final image
- Development dependencies
- Build tools and compilers
- Source code if only wheels are needed