Setting Up Your MLOps Toolchain and Workflow

Set up a reproducible local MLOps development environment by installing and configuring Git, Python with virtual environments, Docker, and supporting tools, then wire them together into a coherent day-to-day workflow.

Loading video…

What you'll be able to do

  • Install and verify Git, Python, and Docker on a local workstation
  • Create isolated, reproducible Python environments using venv and pip/requirements files
  • Configure Git with a sensible .gitignore and commit workflow for ML projects
  • Build and run a minimal Docker container for an ML workload
  • Describe how the core tools map to stages of the MLOps lifecycle and combine into a daily workflow

Why a Standard Toolchain Matters

MLOps lives at the intersection of data science, software engineering, and operations. Before you can train, version, deploy, or monitor models, you need a reliable, reproducible local environment. A consistent toolchain reduces the classic “it works on my machine” problem and gives every engineer the same baseline.

The four foundations we configure in this lesson are:

  • Git — version control for code, configuration, and pipeline definitions.
  • Python — the dominant language for ML, managed with isolated environments.
  • Docker — containerization so workloads run identically anywhere.
  • Supporting CLI tools — package managers, a code editor, and ML utilities.

Installing and Verifying the Core Tools

Start by confirming each tool is present and on a supported version. Run these in a terminal:

git --version       # expect 2.30+
python3 --version   # expect 3.10+
docker --version    # expect 20.10+
docker run hello-world  # confirms the Docker daemon works

If any command fails, install via your platform: apt/brew for Git and Python, and Docker Desktop (macOS/Windows) or Docker Engine (Linux). On Linux, add your user to the docker group so you don’t need sudo.

Configuring Git for ML Projects

Set your identity once, globally, then create a project-scoped .gitignore so you never commit large or secret artifacts:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main

A good ML .gitignore excludes virtual environments, data, model binaries, and caches:

.venv/
__pycache__/
*.pyc
data/
models/
*.ckpt
.env
.ipynb_checkpoints/

Large datasets and model weights should not live in Git directly — use tools like DVC or object storage and track only pointers/metadata.

Isolated Python Environments

Never install project dependencies into the system Python. Create a per-project virtual environment so dependency versions are pinned and reproducible:

python3 -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install --upgrade pip
pip install scikit-learn pandas
pip freeze > requirements.txt

Commit requirements.txt (or a lockfile from tools like pip-tools, Poetry, or uv) so teammates and CI install the exact same versions. Reproducibility is the central theme of MLOps.

A Minimal Dockerized ML Workload

Docker packages your code and its environment into an image that runs the same on a laptop, CI runner, or cluster. A simple Dockerfile for a Python ML app:

FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "train.py"]

Build and run it:

docker build -t my-ml-app:dev .
docker run --rm my-ml-app:dev

Key practices: copy requirements.txt before the rest of the code so Docker caches the dependency layer; use slim base images; and never bake secrets into the image (pass them at runtime with --env or mounted files).

How the Tools Fit the MLOps Lifecycle

StagePrimary tools
Develop / experimentPython, venv, Git, editor (VS Code)
Version data & modelsDVC, object storage
Package & shipDocker
AutomateGit + CI/CD
Track experimentsMLflow / Weights & Biases

Your daily loop becomes: branch in Git → develop in an activated venv → test → build a Docker image → push and let CI validate it. Mastering this local foundation makes every later MLOps concept — pipelines, registries, deployment — far easier.

Recap

You now have a verified, reproducible workstation: Git for versioning, a virtual environment for isolated dependencies, and Docker for portable execution. These are the non-negotiable foundations for everything that follows in the course.

Check your understanding

6 questions — answer to see instant feedback.

Q1. Why should you copy requirements.txt into the Docker image before copying the rest of your code?
Docker caches layers; copying requirements first means the expensive pip install layer is only rebuilt when dependencies change, not on every code edit.
Q2. What is the recommended way to handle large datasets and model weights in an ML project?
Git is poor at large binaries. You gitignore them and use tools like DVC or object storage, tracking only lightweight pointers/metadata in Git.
Q3. Why create a per-project Python virtual environment instead of installing packages globally?
A venv isolates each project's dependencies and versions, preventing conflicts and enabling reproducible installs from a frozen requirements file.
Q4. Which command confirms that the Docker daemon is actually working after installation?
docker --version only prints the client version; docker run hello-world pulls and runs a container, proving the daemon and runtime work end to end.
Q5. In one short phrase, what is the central MLOps theme that connects venvs, requirements files, and Docker?
Answer:reproducibility
All three tools exist to make environments and runs reproducible across machines and team members, which is the core goal of MLOps foundations.
Q6. Name one tool you would use to track ML experiments (metrics, parameters, runs).
Answer:MLflow
MLflow (or Weights & Biases) is commonly used to track experiment parameters, metrics, and artifacts across runs.
Ask the AI tutor about this lessonStuck or curious? Ask a question and get a grounded answer.

The tutor answers from this lesson's material and can make mistakes — verify anything important.