microsoft / microsoft/vscode-remote-release

Host networking causes an explosion of Docker processes

Open
#9,993 4 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug containers
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

When I create a devcontainer with host networking and try to connect to a forwarded port, I am getting an explosion of Docker processes that keeps increasing until all memory has been consumed. I think this might be the underlying issue behind https://github.com/microsoft/vscode-remote-release/issues/4079 and https://github.com/microsoft/vscode-docker/issues/2875 too.

Setup information

$uname -a
Linux isengard 6.9.5-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sun, 16 Jun 2024 19:06:18 +0000 x86_64 GNU/Linux
$ docker --version
Docker version 26.1.4, build 5650f9b102
$code --version
1.90.2
5437499feb04f7a586f677b155b039bc2b3669eb
x64

And my version of the devcontainers extension is v0.369.0.

Minimum reproducible example

  1. Create an folder with the following content
$ tree -a
.
└── .devcontainer
    ├── devcontainer.json
    └── Dockerfile

devcontainer.json:

{
   "name": "temp",
   "build": { "dockerfile": "Dockerfile" },
   "runArgs": [
      "--network=host"
   ]
}

Dockerfile:

FROM python:3.11.6-slim-bookworm
  1. Forward a port such as 1234
  2. Outside of the container, connect to that port using the browser or curl https://localhost:1234/
  3. Watch the explosion of Docker processes until you shutdown curl or run out of memory and have to reboot.
[mallwright@isengard ~]$ ps -x | grep docker | wc -l
8
# started curl
[mallwright@isengard ~]$ ps -x | grep docker | wc -l
39
[mallwright@isengard ~]$ ps -x | grep docker | wc -l
51
[mallwright@isengard ~]$ ps -x | grep docker | wc -l
63
[mallwright@isengard ~]$ ps -x | grep docker | wc -l
74
[mallwright@isengard ~]$ ps -x | grep docker | wc -l
97
[mallwright@isengard ~]$ ps -x | grep docker | wc -l
108
# stopped curl
[mallwright@isengard ~]$ ps -x | grep docker | wc -l
8
[mallwright@isengard ~]$ ps -x | grep docker | wc -l
8

Regarding how fast this is happening, I would say around 10 new processes are being created every second, consuming an additional 300 MB per second. I have 24 GB of RAM on my system so everything comes to a halt after about 10-15 seconds.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.