| Order | 9 |
|---|---|
| Area | advancedcontainers |
| TOCTitle | Set Docker Compose project name |
| PageTitle | Set Docker Compose project name |
| ContentId | 3071cf6e-1a93-498a-91e9-48f439c589b3 |
| MetaDescription | Set Docker Compose project name |
| DateApproved | 12/10/2025 |
Visual Studio Code will respect the value you configure for the Docker Compose project name.
The top-level property name in the docker-compose.yml can be used to set the project name.
Alternatively, you can set the COMPOSE_PROJECT_NAME environment variable for the VS Code process, or specify it in a .env file in the same folder as the docker-compose.yml.
Note: make sure to close all open VS Code windows first.
To start VS Code from the command line:
# from bash
COMPOSE_PROJECT_NAME=foo code .# from PowerShell
$env:COMPOSE_PROJECT_NAME=foo
code .Alternatively, add the following entry to a .env file in the same folder as the docker-compose.yml:
COMPOSE_PROJECT_NAME=foo
When no project name is configured and the docker-compose.yml is in the .devcontainer folder, the Docker Compose default of using the docker-compose.yml folder's basename is overridden with ${project-folder-basename}_devcontainer to avoid name collisions with other projects.