6 Package the application and run PostgreSQL
An image is a packaged filesystem and execution configuration. A container is a running instance with isolation provided by the host. A volume stores data independently of an application container's writable layer.
- Image container and volume
- Run the stack
- Configuration and credentials
- Resource and storage behavior
- Restart and recovery exercise
- Clean shutdown
- Exit exercise
Outcome: run the API, worker, and database as distinct processes with explicit configuration. Prerequisites: local project completion and Docker with Compose. Environment: your laptop or a disposable Linux VM. Cost: local CPU, memory, and image storage. An image is a packaged filesystem and execution configuration. A container is a running instance with isolation provided by the host. A volume stores data independently of an application container's writable layer. Removing an application container should not delete the database. Removing the database volume can. The Dockerfile installs locked dependencies, copies the application, creates a non-root user, and starts Uvicorn. The Compose file defines separate database, initialization, API, and worker services. The API is published only to the host's loopback address; the database has no published port.