features icon indicating copy to clipboard operation
features copied to clipboard

docker-in-docker does not work

Open eluinstra opened this issue 1 year ago • 11 comments

hello,

I'm experiencing a problem with the latest docker-in-docker feature (2.12.4). When I'm running the following docker compose file:

services:
  neo4j:
    image: neo4j:5.3.0-community
    ports:
      - 7474:7474
      - 7687:7687
    environment:
      NEO4J_AUTH: username/password
      DUMPPREFIX: Neo4j-dmp-dev
    healthcheck:
      test: wget http://localhost:7474 || exit 1
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 40s

the container seems to be starting, but it never gets a healthy status.

When I try to connect to the container using the following command:

docker exec -it neo4j-1 sh

I get the following error in WSL:

OCI runtime exec failed: exec failed: unable to start container process: procReady not received: unknown

and the following error on Mac:

OCI runtime exec failed: exec failed: unable to start container process: error writing config to pipe: write init-p: broken pipe: unknown

This is the devcontainer.json I used:

{
	"name": "Simca",
	"image": "mcr.microsoft.com/devcontainers/base:noble",
	"mounts": [
		"type=bind,source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh/,target=/home/vscode/.ssh,readonly"
	],
	"features": {
		"ghcr.io/devcontainers/features/docker-in-docker:2": {},
		"ghcr.io/devcontainers/features/node:1": {
			"version": "22.16.0"
		},
		"ghcr.io/devcontainers/features/java:1": {
			"installMaven": true,
			"mavenVersion": "3.9.8",
			"installGradle": true,
			"version": "17",
			"additionalVersions": "21.0.7-ms"
		},
		"ghcr.io/devcontainers-extra/features/apt-packages:1": {
			"packages": "libfreetype6,fontconfig,graphviz"
		},
		"ghcr.io/nordcominc/devcontainer-features/android-sdk:1": {}
	},
	"forwardPorts": [
		5672,
		7474,
		7687,
		8080,
		8081,
		8082,
		8088,
		9000,
		9092,
		15672,
		15674
	],
	"customizations": {
		"vscode": {
			"settings": {
				"plantuml.exportOutDir": ".",
				"plantuml.exportSubFolder": false,
				"sonarlint.ls.javaHome": "/usr/local/sdkman/candidates/java/21.0.7-ms",
				"sonarlint.pathToNodeExecutable": "/usr/local/share/nvm/versions/node/v22.16.0/bin/node"
			},
			"extensions": [
				"donjayamanne.githistory",
				"mhutchie.git-graph",
				"humao.rest-client",
				"jebbs.plantuml",
				"sonarsource.sonarlint-vscode",
				"redhat.fabric8-analytics"
			]
		}
	}
}

I tried to configure the docker-in-docker feature, with docker version 28.0.4 and 26.1 without success.

For now I provided a Dockerfile based on the ms noble image, that installs docker and use that in de devcontainer. That works on amd based machines, but not on arm.

This may be the same issue as https://github.com/devcontainers/features/issues/1491, although I experience problems on both noble and jammy.

kind regards, Edwin

eluinstra avatar Oct 07 '25 14:10 eluinstra

Running into the same error. Can I ask when this would be fixed? or is there a workaround besides install dind via Dockerfile?

strangeundersun avatar Oct 08 '25 13:10 strangeundersun

Running into the same error here. Replacing all docker exec occurences into docker run is working but is kinda ugly. It compromises healtchecks as well but this is bypassable by creating a container that will do the check and add the condition to wait for it to complete succesfully.

lerenn avatar Oct 08 '25 14:10 lerenn

As a temporary workaround, please try setting moby to false when configuring your docker-in-docker feature, as this appears to resolve the issue. We are continuing to investigate the root cause.

v-Mathiyarasy avatar Oct 08 '25 15:10 v-Mathiyarasy

Thanks for the workaround. I had to remove the existing images first.

eluinstra avatar Oct 08 '25 15:10 eluinstra

another (uglier) workaround, doing

kill $(pgrep dockerd)
dockerd &

stroebitzer avatar Oct 13 '25 10:10 stroebitzer

I also encountered an issue where the dind features stopped working in the official Ruby on Rails devcontainer: ghcr.io/rails/devcontainer/images/ruby

The cause was that the image switched from Debian 12 to Debian 13, which made moby unavailable. The workaround is described here: https://github.com/devcontainers/features/issues/1494#issuecomment-3381991489

This is outside the scope of the current issue, but I believe features need a common mechanism to check dependencies and compatibility with the target image. Right now, each feature handles this manually within its own shell scripts…

syncsyncsynchalt avatar Oct 17 '25 00:10 syncsyncsynchalt

For what it's worth, I had the exact issue in this ticket, and it was fixed with "moby": false.

But, in just the last few days, docker-ce v29.0 was released. And something in the networking changes seems to have completely broken outgoing connections for containers. The release notes list several things that might plausibly break this, but (annoyingly) these aren't listed as "breaking changes" at the top. They are mixed into the list of "Networking" changes: https://docs.docker.com/engine/release-notes/29/#networking.

I fixed this new issue by adding "version": "28.5" to my config.

nevans avatar Nov 14 '25 20:11 nevans

Same issue here - running in a Debian Bookworm container. "moby": false doesn't work us due to internal connectivity issues.

Will revert to the old "docker-in-docker" rather than "ghcr.io/devcontainers/features/docker-in-docker" for now, but would be great to get on the latest version.

Thanks

erichards97 avatar Dec 03 '25 11:12 erichards97

Same symptom but likely different cause. In my case, docker-in-docker wasn't working cause my Linux kernel is too new? Running the below inside the devcontainer to use a legacy translation binary fixed it for me:

sudo update-alternatives --set iptables /usr/sbin/iptables-nft
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-nft

Running Docker version 29.1.3-1, build f52814d454173982e6692dd7e290a41b828d9cbc with no options configured for ghcr.io/devcontainers/features/docker-in-docker:2. Host system is on Linux 6.18.2 running Docker 29.1.3 too.

Interpause avatar Dec 28 '25 07:12 Interpause

Same symptom but likely different cause. In my case, docker-in-docker wasn't working cause my Linux kernel is too new? Running the below inside the devcontainer to use a legacy translation binary fixed it for me:

sudo update-alternatives --set iptables /usr/sbin/iptables-nft sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-nft Running Docker version 29.1.3-1, build f52814d454173982e6692dd7e290a41b828d9cbc with no options configured for ghcr.io/devcontainers/features/docker-in-docker:2. Host system is on Linux 6.18.2 running Docker 29.1.3 too.

This works for me too, my host is on linux 6.18.7

RadeJR avatar Jan 31 '26 17:01 RadeJR

This should have resolved now with this change. Kindly get back otherwise.

v-Kaniska244 avatar Jul 08 '26 07:07 v-Kaniska244