Docker Guide for Data Scientists
Table of Contents
1. Docker Basics
What is Docker?
Docker is a platform for developing, shipping, and running applications in containers.
Key Concepts
- Image: Blueprint for creating containers
- Container: Running instance of an image
- Dockerfile: Instructions for building images
- Docker Hub: Repository for sharing images
2. Docker Images
# Pull an image
docker pull python:3.9
# List images
docker images
# Remove an image
docker rmi python:3.9
3. Containers
# Run a container
docker run -it python:3.9 bash
# Run in background
docker run -d -p 8000:8000 my-app
# List running containers
docker ps
# Stop a container
docker stop container_id
4. Dockerfile
# Dockerfile
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]
5. Docker Compose
# docker-compose.yml
version: '3.8'
services:
web:
build: .
ports:
- "8000:8000"
depends_on:
- db
db:
image: postgres:13
environment:
POSTGRES_PASSWORD: password
Download Docker Guide PDF
Get the complete Docker Guide as a free PDF. Enter your email to receive the download link.
Start Learning with DSWallah
Join 300+ students who transformed their careers with DSWallah. IIT-certified mentor, 50+ real projects, placement support.
WhatsApp for Free Demo →