Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev container initializeCommand not being executed on the DevPod provider machine #1640

Open
zombiemaker opened this issue Feb 13, 2025 · 0 comments
Labels

Comments

@zombiemaker
Copy link

What happened?
Dev container initializeCommand is being executed on the DevPod host computer system.

What did you expect to happen instead?
Dev container initializeCommand should be executed on the dev container host computer system.

Per the dev container specification:

A command string or list of command arguments to run on the host machine during initialization, including during container creation and on subsequent starts. The command may run more than once during a given session.

The command is run wherever the source code is located on the host. For cloud services, this is in the cloud.

How can we reproduce the bug? (as minimally and precisely as possible)

  • create a dev container Git repo with devcontainer.json configuration file with initializeCommand set to something like "echo HELLO FROM initializeCommand"
  • configure DevPod to use a Kubernetes provider
  • configure DevPod to enable Debug messages
  • create a DevPod workspace using Git repo and Kubernetes provider
  • view DevPod log messages

My devcontainer.json:

{
    "name": "ubuntu",
    "image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",
    "initializeCommand": {
        "any": "echo HELLO FROM initializeCommand"
    },
    "onCreateCommand": {
        // "bashScript": ".devcontainer/scripts/gnu-bash/onCreateCommand.bash"
        // "powershellScript": ".devcontainer/scripts/powershell/onCreateCommand.ps1"
    },
    "updateContentCommand": {
        // "bashScript": ".devcontainer/scripts/gnu-bash/updateContentCommand.bash"
        // "powershellScript": ".devcontainer/scripts/powershell/updateContentCommand.ps1"
    },
    "postCreateCommand": {
        // "bashScript": ".devcontainer/scripts/gnu-bash/postCreateCommand.bash"
        // "powershellScript": ".devcontainer/scripts/powershell/postCreateCommand.ps1"
    },
    "postStartCommand": {
        // "bashScript": ".devcontainer/scripts/gnu-bash/postStartCommand.bash"
        // "powershellScript": ".devcontainer/scripts/powershell/postStartCommand.ps1"
    },
    "postAttachCommand": {
        // "bashScript": ".devcontainer/scripts/gnu-bash/postAttachCommand.bash"
        // "powershellScript": ".devcontainer/scripts/powershell/postAttachCommand.ps1"
    }
}

Local Environment:

  • DevPod Version: v0.6.11
  • Operating System: windows
  • ARCH of the OS: AMD64

DevPod Provider:

  • Kubernetes Provider: Client Version = v1.32.1; Kustomize Version = v5.5.0; Server Version: v1.32.1

Anything else we need to know?
When using VS Code Dev Containers (running on Windows) to create dev containers that are running in either Windows Subsystem for Linux 2 or a remote Linux computer system, the VS Code devcontainer subsystem runs initializeCommand on the container host system (Linux). VS Code is not running the initializeCommand on the VS Code host computer system (i.e. Windows). DevPod's implementation seems of this feature is not mimicking the behavior of VS Code Dev Containers extension, which I assume is acting as a reference implementation.

Another difference is VS Code Dev Containers executes the initializeCommand using the Bourne Shell (sh) (not Bourne Again Shell (bash) and not Windows CMD shell). DevPod running on Windows seem to default to running the initializeCommand using Windows CMD shell. VS Code Dev Containers does not support Windows containers. It only supports Linux containers. Thus, it is odd that DevPod's implementation of the dev container initializeCommand uses Windows CMD and not a Linux shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant