microsoft / microsoft/vscode-remote-release
`initializeCommand` implementation and documentation don't align
@chrmarti is already working on this.
Since Dec 16, 2024.
- Dominant language
- Dockerfile
- Stars
- 4.2k
- Forks
- 470
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
- VSCode Version:1.78.2
- Local OS Version: Mac OS Ventura 13.3.1
- Remote OS Version: N/A
- Remote Extension/Connection Type: Containers/WSL/Server
- Logs:
Steps to Reproduce:
- Create a new devcontainer.
- Add an
initializeCommandto the devcontainer in.devcontainer.json. For example:
#!/usr/bin/env bash
# .devcontainer/initialize-command.sh
set -e
echo "Initializing the dev container!!!!"
sleep 20;
devcontainer.json:
"initializeCommand": "./.devcontainer/initialize-command.sh",
- Open the project in a dev container.
- Once the devcontainer has finished building, close the workspace.
- Go to "Open Recent" and reopen the workspace with the devcontainer
EXPECTED: As per the devcontainer lifecycle scripts documentation, you should see an echo when the container is first created but no echo when the container is reopened because the container has already been created.
ACTUAL: initializeCommand is run every time the workspace is reopened. I think this maps more to preStartCommand than the preCreateCommand.
As per the devcontainer spec, initializeCommand` is "a command string or list of command arguments to run on the host machine before the container is created."
As far as I can tell, this either means that:
- The devcontainer spec documentation is wrong or
- VSCode isn't following the spec here
Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: Yes
@chrmarti, who helped implement this initially
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.