devcontainers/spec

Docker 25 gives error using network_mode parameter

SteeveGL opened this issue · 3 comments

Devcontainer won't start if you set using docker-compose file and set the parameter network_mode. I could reproduce the issue with Docker version 25.0.4 but not with docker version 24.0.9.

I don't have hand on log right now, but they wasn't really helpful. Just complaining about the container not running and also the container was exit with code 0.

Hi 👋

Would you be able to provide us with a sample dev container for being able to reproduce this issue? I wasn't able to reproduce the issue.

@samruddhikhandale there is

{
  "dockerComposeFile": "docker-compose.yml",
  "service": "devcontainer",
  "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
  "remoteEnv": {
    "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
    "ASPNETCORE_Kestrel__Certificates__Default__Path": "${containerEnv:HOME:/home/vscode}/.aspnet/https/aspnetapp.pfx"
  },
  // Use 'postCreateCommand' to run commands after the container is created.
  // "postCreateCommand": "./.devcontainer/postCreateCommand.sh",
  "portsAttributes": {
    "7291": {
      "label": "https",
      "protocol": "https"
    }
  },
  "otherPortsAttributes": {
    "onAutoForward": "silent"
  },
  // Configure tool-specific properties.
  "customizations": {
    "vscode": {
      "extensions": [
        "ms-dotnettools.csharp" // C# for Visual Studio Code
        // "ms-dotnettools.csdevkit" // C# Dev Kit for Visual Studio Code
      ]
    }
  },
  "shutdownAction": "stopCompose"
}
services:
  devcontainer:
    image: mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm
    volumes:
      - ../..:/workspaces:cached
    network_mode: service:mongo
    command: sleep infinity

  mongo:
    image: mongo:7.0.4

  mongo-express:
    image: mongo-express
    ports:
      - 8091:8081

Since I downgraded to Docekr version 24 and network_mode give me issue with DNS. No name resolution.

I find out. I switched to an old server and mongo won't start. That block devcontainer to run.