liveBook · Manning

Docker

As explained in Fight Fraud with Machine Learning

Docker is a platform for packaging, distributing, and running applications in isolated environments called containers.

Docker packages, distributes, and runs applications in isolated containers. For fraud detection, it bundles a Flask prediction service, its dependencies, deployment instructions, and model artifact into a repeatable unit that can ship across payment processors. section 3.8.3 section 3.9

A containerized fraud-prediction service follows this workflow:

  • Write a Dockerfile describing the base Python environment, system dependencies, copied service files, model download, Python packages, user, and entry point. section 3.8.3
  • Build a tagged Docker image, inspect the resulting images, and launch an instance from the image. section 3.8.3
  • Map the host and container ports so clients can send network requests to the running Flask service. section 3.8.3

Containerizing a fraud model service

A Dockerfile can start from python:3.10-slim, install wget, copy model_server.py and requirements.txt, obtain model.joblib, install dependencies, and use python model_server.py as its entry point. Build it with docker build -t otf ., then launch it with docker run -p 8890:8890 otf. The service becomes available on the mapped port for online transaction predictions. section 3.8.3 section 3.8

Figure 3.28 Steps to containerize an ML service using Docker.

Follow the deployment sequence from Dockerfile creation through image building and container launch. section 3.8.3

How Fight Fraud with Machine Learning covers it

How deep it goes
Explains Dockerfiles, image construction, image inspection, port mapping, and container launch through concrete commands.
Examples
Uses a random forest service, model_server.py, requirements.txt, model.joblib, and port 8890 as deployment artifacts.
What it assumes
Assumes a trained model, Python inference code, Flask service, and dependency list; teaches packaging these deployment requirements together.
What you can do after
Operate/configure a containerized Flask service that serves real-time fraud predictions through a mapped network port.
How it connects
Connects containerization with Python, Flask, Dockerfiles, Docker images, model artifacts, and online inference.

Also explained in

Compare how 28 books explain Docker →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fight Fraud with Machine Learning. The section links point to the parts of the book it draws on.