Docker Compose services not shutting down with shutdownAction: stopCompose

Describe the Bug

I am experiencing an issue where my Docker Compose containers do not shut down automatically when I close a remote container session in Cursor. In VS Code, using the standard ms-vscode-remote.remote-containers extension, closing the editor window also shuts down the entire docker-compose stack as expected. In Cursor, with the Anysphere Dev Containers extension, the containers remain running in the background, requiring me to manually run docker-compose down to stop them.

This happens even when shutdownAction is explicitly set to stopCompose in the devcontainer.json file.

Steps to Reproduce

  1. Create a project with a .devcontainer folder containing a devcontainer.json file and a docker-compose.yml file.

  2. Configure the devcontainer.json to use the Docker Compose file and include “shutdownAction”: “stopCompose”.

  3. Open the project folder in Cursor.

  4. Use the command “Dev Containers: Reopen in Container” to launch the development environment.

  5. Once the container is running and the editor is attached, close the Cursor window or use the “Close Remote Connection” command.

  6. Check the status of the Docker containers in a terminal using docker ps.

Expected Behavior

When the Cursor window is closed or the remote connection is terminated, the Docker Compose services defined in the docker-compose.yml file should be stopped. The output of docker ps should show no running containers related to the project.

Operating System

Linux

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.2.2
VSCode Version: 1.99.3
Commit: faa03b17cce93e8a80b7d62d57f5eda6bb6ab9f0
Date: 2025-07-07T06:13:23.028Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Linux x64 6.14.0-23-generic

Additional Information

The Docker Compose services continue to run in the background after closing the Cursor window. I have to manually navigate to the project directory and run docker-compose down to stop them.

This functionality is critical for a smooth development workflow and proper resource management, as it prevents orphaned containers from consuming system resources. The behavior seems to be a regression from the standard functionality provided by the official VS Code extension. Thank you for looking into this!

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

1 Like

Hi @Leonardo_Ornelas, thank you for this bug report – we’re working on implementing support for this flag.

1 Like

Hi @Leonardo_Ornelas, we added support for the shutdownAction in version 1.0.13 of the extension. Could you try upgrading to the latest version?

1 Like

Hi @ravirahman , thanks for the update, but sadly, the issue persists with the new version (1.0.13).

❯ docker version
Client: Docker Engine - Community
Version: 28.3.2
API version: 1.51
Go version: go1.24.5
Git commit: 578ccf6
Built: Wed Jul 9 16:14:01 2025
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 28.3.2
API version: 1.51 (minimum version 1.24)
Go version: go1.24.5
Git commit: e77ff99
Built: Wed Jul 9 16:14:01 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0

~
❯ docker compose version
Docker Compose version v2.38.2

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.