Compose uses a project name to isolate environments from each other.
The default project name is based on the name of the directory where the docker-compose.yml is located (ie the basename of the project directory)
You can make use of this project name in several different contexts:
- on a dev host, to create multiple copies of a single environment (e.g., you want to run a stable copy for each feature branch of a project)
- on a CI server, to keep builds from interfering with each other, you can set the project name to a unique build number
- on a shared host or dev host, to prevent different projects, which may use the same service names, from interfering with each other
You can set a custom project name by:
- using the -p or –project-name flag
- or the COMPOSE_PROJECT_NAME environment variable.