Deployment requirements
- software requirements (python package dependencies, python version)
- OS requirements (operating system, system packages, config)
- hardware/resource requirements (CPU, RAM, storage, GPU, networking – ports, load balancing etc)
Dockerfile
recipedocker build .
package the codedocker run <image>
run the container
cheat sheet
command | task |
---|---|
docker build . | build a docker image |
docker build -t <image-name>:<tag> | add image name and tag |
docker images | list docker images |
docker pull <image-name>:<tag> | run image tag |
docker run <image-name>:<tag> | run image:tag |
docker contain ls | list running containers |
docker-compose up | spin up docker compose |
docker-compose up -d | spin up in detached mode |
docker-compose down | spin down docker compose |
basic Dockerfile
FROM
, COPY
, RUN
, CMD
scaling
Docker compose lets you run multiple containers. For small workloads, Amazon EC2 and docker compose works well.
Docker orchestrators deal with discoverability, auto-scaling, bin packing (distributing across multiple servers given CPU RAM constraints). These range from docker swarm, to kubernetes (industry standard).
Consider modal (blog post) as an alternative to these files for python jobs where we can specify images, cron jobs, GPUs etc where code executes in the cloud but is printed locally.