Base images¶
Reference for Playpen base images.
Available images¶
playpen/python-base¶
Python 3.11 with web frameworks and data science libraries.
Use for: - Web APIs (Flask, FastAPI) - Data processing (Pandas, NumPy) - Basic machine learning (scikit-learn)
Included libraries: - Flask 2.3.3 - FastAPI 0.103.1 - NumPy 1.24.3 - Pandas 2.0.3 - Scikit-learn 1.3.0 - Matplotlib 3.7.2 - Seaborn 0.12.2 - Jupyter 1.0.0
Example Dockerfile:
FROM playpen/python-base:latest
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "app.py"]
playpen/ml-runtime¶
ML runtime with PyTorch, transformers, and vector databases.
Use for: - Deep learning (PyTorch) - Transformers (Hugging Face) - Vector databases (ChromaDB) - Experiment tracking (MLflow) - RAG applications
Included libraries: - PyTorch 2.0.1 - Transformers 4.33.2 - MLflow 2.7.1 - ChromaDB 0.4.15 - Sentence Transformers 2.2.2
Example Dockerfile:
FROM playpen/ml-runtime:latest
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "train.py"]
playpen/r-base¶
R environment with Posit compatibility.
Use for: - Statistical analysis - R Shiny applications - Data visualization - Report generation
Example Dockerfile:
Building base images¶
Build all base images:
Build individual image:
Using base images¶
In Dockerfile¶
In Kubernetes¶
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
template:
spec:
containers:
- name: app
image: playpen/python-base:latest
In Jenkins pipeline¶
pipeline {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: python
image: playpen/python-base:latest
"""
}
}
}
Image locations¶
Base images are built locally and can be: - Used directly in deployments - Pushed to Nexus registry - Tagged for versioning
Push to Nexus¶
# Tag image
docker tag playpen/python-base:latest nexus:5000/python-base:1.0.0
# Push to Nexus
docker push nexus:5000/python-base:1.0.0
Customizing base images¶
Extend base image¶
FROM playpen/python-base:latest
# Install additional packages
RUN pip install custom-package==1.0.0
# Copy application code
COPY . /app
WORKDIR /app
CMD ["python", "app.py"]
Build custom base¶
FROM playpen/python-base:latest
# Add custom configuration
COPY custom-config /etc/custom/
# Install custom tools
RUN apt-get update && apt-get install -y custom-tool
Versioning¶
Base images use latest tag by default. For production:
# Tag with version
docker tag playpen/python-base:latest playpen/python-base:1.0.0
# Use versioned image
FROM playpen/python-base:1.0.0
Troubleshooting¶
Image not found¶
- Verify image exists:
docker images | grep playpen - Build image:
./scripts/install-base-images.sh - Check image name and tag
Build fails¶
- Check Dockerfile syntax
- Verify base image exists
- Check disk space
Next steps¶
- Learn about configuration
- Review best practices