Containerization
Containerization packages an application and its dependencies into a standardized unit for software development.
Docker
Docker is the de facto standard for containerization.
Steps for Containerization
- Create a Dockerfile
- Specify base image and files to copy
- Specify run command
- Build Docker image
- Tag Docker image
Example Dockerfile
FROM python:3.7
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
CMD ["python", "inference.py"]
Best Practices
- Be security-minded
- Don't include sensitive data
- Use trusted base images
- Use environment variables for sensitive information