Docker & Apptainer Containers
Kubernetes executes container images based on the Open Container Initiative (OCI) standard. You can build your images using Docker, Podman, or Apptainer / Singularity.
Example: Scientific Python & CUDA Dockerfile
Section titled “Example: Scientific Python & CUDA Dockerfile”Here is a recommended Dockerfile template with non-root user permissions and PyTorch GPU support:
# Use official NVIDIA PyTorch base imageFROM pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime
# Install system utilities and scientific librariesRUN apt-get update && apt-get install -y --no-install-recommends \ git \ curl \ htop \ rsync \ libgl1-mesa-glx \ && rm -rf /var/lib/apt/lists/*
# Install Python requirementsCOPY requirements.txt /tmp/requirements.txtRUN pip install --no-cache-dir -r /tmp/requirements.txt
# Create non-root research user (UID 1000)RUN useradd -m -u 1000 scientistUSER scientistWORKDIR /home/scientist
# Copy project source codeCOPY --chown=scientist:scientist . /home/scientist/app
CMD ["python", "app/train.py"]Building and Pushing to Berkelium Harbor
Section titled “Building and Pushing to Berkelium Harbor”# Build the container image locallydocker build -t registry.berkelium.lbl.gov/sci-als/synchrotron-model:v1 .
# Log in and pushdocker push registry.berkelium.lbl.gov/sci-als/synchrotron-model:v1