liveBook · Manning

Container label

As explained in Learn Docker in a Month of Lunches, Second Edition

A container label is a key/value metadata attribute attached to a container through its configuration.

A container label is configuration metadata attached to a container. Traefik reads these labels through the Docker API and builds routing configuration without a separate file for each application. section 20.4

Route an application with labels

A Compose service can enable Traefik, route whoami.local to the application, and identify the container port with three labels.

Deploying or changing the labeled application updates Traefik while it watches for containers; restarting Traefik or maintaining a separate application configuration file is unnecessary. section 20.4

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains Docker API discovery and dynamic updates, with representative label syntax but no exhaustive label reference.
Examples
Demonstrates whoami routing with host rules and service ports, then applies labels to an image-gallery application.
What it assumes
Assumes Docker containers, Docker Engine connectivity, and basic Compose operation while demonstrating label-driven proxy configuration.
What you can do after
Apply via Docker Compose and Traefik labels to expose applications, route requests, and update proxy configuration dynamically.
How it connects
Connects container labels with Traefik, reverse proxies, Docker API, routing rules, HTTPS, and load balancing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.