Stdio Docker MCP containers remain running after closing a session
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
Describe the bug
When multiple Copilot CLI sessions use local stdio MCP servers running in Docker, closing one session does not terminate the Docker containers started for that session.
The behavior occurs with both:
- A direct Docker MCP.
- A Node wrapper that starts.
Because both MCP implementations reproduce the problem, this appears to be a Copilot CLI stdio MCP lifecycle issue rather than a problem in either Docker image.
After using multiple sessions, docker ps showed three active instances of each image:
matheusrhgestor/html2pdf-mcp
matheusrhgestor/html2pdf-mcp
matheusrhgestor/html2pdf-mcp
matheusrhgestor/kendo-ui-doc
matheusrhgestor/kendo-ui-doc
matheusrhgestor/kendo-ui-doc
In one reproduction:
- A session was resumed around 11:45 local time.
- Its session shutdown was recorded around 11:54 local time.
- The
kendo-ui-docandhtml2pdf-mcpcontainers created around 11:44 remained inUpstate afterward. - A new active session started another pair around 11:55.
Representative container output:
052529bdf996|matheusrhgestor/html2pdf-mcp|Up 7 minutes
1793cf8f1aad|matheusrhgestor/kendo-ui-doc|Up 7 minutes
9870e1fd5c7f|matheusrhgestor/html2pdf-mcp|Up 18 minutes
d1bc7dd02cd6|matheusrhgestor/kendo-ui-doc|Up 18 minutes
e161b8af2fb7|matheusrhgestor/html2pdf-mcp|Up 39 minutes
fc11f628ff81|matheusrhgestor/kendo-ui-doc|Up 39 minutes
Affected version
1.0.79
Steps to reproduce the behavior
-
Configure the
kendo-ui-docMCP as a local stdio server using Docker:{ "type": "local", "command": "docker", "args": [ "run", "--rm", "-i", "matheusrhgestor/kendo-ui-doc" ] } -
Configure the
html2pdfMCP as a local stdio server using a Node wrapper that starts:docker run --rm -i --mount ... matheusrhgestor/html2pdf-mcp -
Start Copilot CLI session A and verify that one container per MCP is running.
-
Start Copilot CLI session B and verify that a second pair of containers is running.
-
Close session A using the normal session exit action, such as
/exitorCtrl+D. -
Run:
docker ps --all --format "{{.ID}}|{{.Image}}|{{.Status}}|{{.Names}}|{{.CreatedAt}}" -
Observe that the containers created for session A are still running.
Expected behavior
Closing a session should disconnect its stdio MCP processes and stop/remove only the containers created by that session.
The --rm option should remove each container after the corresponding docker run process is terminated.
Containers belonging to other active Copilot CLI sessions should remain running.
Additional context
- Operating system: Windows 11 Pro
- Architecture: x64
- Shell: command prompt
- MCP transport: local stdio
- Docker images:
matheusrhgestor/kendo-ui-docmatheusrhgestor/html2pdf-mcp
The direct kendo-ui-doc configuration uses docker run --rm -i.
The html2pdf wrapper uses Node child_process.spawn with stdio: "inherit" and also starts Docker with --rm -i. Therefore, --rm cannot clean up the container while the Docker process is still alive.
The issue is reproducible across more than one session and more than one MCP implementation. The likely failure is that closing a Copilot CLI session does not propagate termination to the local stdio MCP process and its Docker child process.
This appears related to:
https://github.com/github/copilot-cli/issues/4049
https://github.com/github/copilot-cli/issues/3440
This report concerns concurrent sessions and closing one session, rather than only /new or /resume.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện sự cố với hai phiên Copilot CLI sử dụng các lệnh MCP stdio cục bộ được khởi chạy thông qua Docker, sau đó lần theo đường dẫn tắt phiên đối với các tiến trình con đó. Công việc được coi là hoàn tất khi việc đóng một phiên chỉ kết thúc và xóa các container Docker của phiên đó, trong khi các container của phiên đang hoạt động còn lại vẫn tiếp tục chạy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- docker, node.js
- Lĩnh vực
- cli, devops
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 52/100