Anysphere Dev Container butchers my COMPOSE_PROJECT_NAME

Describe the Bug

In my .env file I have COMPOSE_PROJECT_NAME=FOO at the top. Previously under MS dev container extension that meant I could use docker compose normally under CLI (on the host) to interact with the dev container stack.

With the Anysphere rewrite of the Dev Containers extension, my COMPOSE_PROJECT_NAME is being butchered with a compose_project_name- prefix.

When I view the dev container startup logs, I see this:

2025-07-25 10:08:48.297 [info] Finished Read Dev Container Configuration: {
  "outcome": "success",
  "containerId": "687574ccf897a64036da118551dd325ad498c7cc05599ef4e5ccce544f87a86e",
  "composeProjectName": "compose_project_name-FOO",
  ...

But my .devcontainer.json file does NOT contain any composeProjectName.

Steps to Reproduce

  • Create a .env file with COMPOSE_PROJECT_NAME=FOO at the top.
  • Omit composeProjectName from your .devcontainer.json file.
  • Note that Finished Read Dev Container Configuration in dev container logs includes composeProjectName with compose_project_name- prefix.

Expected Behavior

COMPOSE_PROJECT_NAME in .env should be respected.

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.2.4
VSCode Version: 1.99.3
Commit: a8e95743c5268be73767c46944a71f4465d05c90
Date: 2025-07-10T16:53:59.659Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.5.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hi @mrmachine, thank you for this bug report. When trying to reproduce it, we ran into this error:

invalid project name "FOO": must consist only of lowercase alphanumeric characters, hyphens, and underscores as well as start with a letter or number

when changing the COMPOSE_PROJECT_NAME to “foo”, then the container built and opened without any issues.

2025-07-28 11:33:53.135 [info] Finished Read Dev Container Configuration: {
  "outcome": "success",
  "containerId": "d9f0a647b0280acb18104f508e62ab523ffd79838aa571f2f7531e91ed1a1b40",
  "composeProjectName": "foo",
  "remoteUser": "node",

Could you verify this variable isn’t set by another file – such as .bashrc, .bash_profile, or .profile?

Does it work when you use a lowercase variable name?

By FOO I meant whatever (valid) name you want. But I have created a minimal project to reproduce the issue and there is one more step I previously omitted.

In your .env file you need to have COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-foo}

Then the Anysphere Dev Containers extension is converting that to an invalid composeProjectName:

2025-07-29 11:02:21.793 [info] Finished Read Dev Container Configuration: {
  "outcome": "success",
  "containerId": "dae0e36cd6c47222967df465146857a31adcd3ee973a7c8d27289e7a241df996",
  "composeProjectName": "compose_project_name-foo",
...

Docker Compose itself is able to understand this COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-foo} assignment:

$ docker compose config
name: foo
services:
  dev:
    build:
      context: /Users/.../bar
      dockerfile: Dockerfile
    command:
      - sleep
      - infinity
    environment:
      CPN: foo
    networks:
      default: null
networks:
  default:
    name: foo_default

Here’s the entire project to reproduce…

.env:

COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME:-foo}

docker-compose.yml:

services:
  dev:
    build:
      context: .
      dockerfile: Dockerfile
    command: sleep infinity
    environment:
      CPN: ${COMPOSE_PROJECT_NAME:-abc123}

Dockerfile:

FROM ubuntu

RUN sleep 15

.devcontainer/devcontainer.json:

{
  "name": "dev",
  "dockerComposeFile": "../docker-compose.yml",
  "service": "dev"
}

It looks like Anysphere Dev Containers is unable to expand the ${COMPOSE_PROJECT_NAME:-default} substitution AND is simply stripping invalid characters (${:}) AND is lowercasing the resulting string.