This project demonstrates how to build and run a custom docker container using Dockerfile. For this project, a PDF Generator app is created and run using Python and ReportLab library. Here’s the project overview:
Dockerfile with the custom setup commandsdocker-tutorial/2-pdf-generator/
├── data/
│ └── report_data.json # Demo data (JSON format)
├── generated_pdfs/ # Directory to store generated PDFs (using Docker volumes)
├── app.py # Python application to generate PDFs
├── Dockerfile # Dockerfile to containerize the app
├── requirements.txt # Python dependencies
└── README.md
Build the Docker Image:
cd 2-pdf-generator
docker build -t pdf-generator .
Run the Docker Container:
docker run --rm -v $(pwd)/generated_pdfs:/app/generated_pdfs pdf-generator
This will mount the generated_pdfs directory from your local machine to the container and generate the PDFs inside the folder.
To check if your container is running:
docker ps
To remove the container:
docker rm <CONTAINER_ID>
To remove the pdf-generator image:
docker rmi pdf-generator