liveBook · Manning

Project name

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

A project name is the identifier Docker Compose uses to group and name the resources belonging to an application deployment.

A project name identifies which resources belong to one Docker Compose application. Compose uses the directory name by default, then prefixes resource names with it. section 10.1

Use the project name to control deployment identity and resource naming:

  • A Compose file in app1 can create app1-disk for a volume and app1-web-1 for a web container. section 10.1
  • Scaled services add a numeric suffix, such as app1-web-2 for a second web container. section 10.1
  • Repeating docker compose up from the same folder reuses the existing application instead of creating another copy. section 10.1
  • Specify a different project name with -p to run separate copies of the same Compose application on one Docker Engine. section 10.1

Run a second to-do application

docker compose -f ./todo-list/docker-compose.yml -p todo-test up -d docker container ls docker container port todo-test-todo-web-1 8080 The explicit name makes this deployment distinct, and its predictable container name begins with todo-test. section 10.1

docker compose -f ./todo-list/docker-compose.yml -p todo-test up -d
docker container ls
docker container port todo-test-todo-web-1 8080

Inspect the created container and find its published port after assigning a project name. section 10.1

When override files define separate environments, give each deployment its own project name. The resulting containers and networks remain isolated, but management commands must repeat the same files and name. section 10.2

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

How deep it goes
Explains default naming, generated resource names, scaling suffixes, explicit overrides, and lifecycle-command consistency.
Examples
Uses to-do and random-number deployments, generated names such as todo-test-todo-web-1, and separate dev, test, and UAT environments.
What it assumes
Assumes basic Docker Compose commands and Compose files while demonstrating project identity from the naming problem.
What you can do after
Operate/configure parallel Compose deployments with -p and manage them using matching files and project names.
How it connects
Connects Docker Compose with containers, volumes, services, networks, scaling, and override files.

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.