Devcontainer `initializeCommand` erroneously runs on container reopen

Open
#9,278 5 comments 4 reactions 1 assignee View on GitHub

@chrmarti is already working on this.

Since Sep 6, 2023.

Assessment

This issue has not been assessed yet.

Description

bug containers

Looking at the devcontainer spec, the initializeCommand is supposed to run when the dev container is created:

A command string or list of command arguments to run on the host machine before the container is created.

However, in practice it seems like the command is also being run when the devcontainer is reopened. This reduces the value of the initializeCommand as a place to do pre-container-creation cleanup and doesn't adhere to the spec.

Here's a link to a video demoing the problem.

Reproduction steps

  1. Clone this repo
  2. Open the folder in VS Code
  3. Open the folder in a dev container. (Command Palette > Dev Containers: Reopen in Container). (As expected, you should see the logs from the initialize command being run.)
  4. Close the dev container (Command Palette > Dev Containers: Reopen Folder Locally).
  5. Reopen the dev container (Command Palette > Dev Containers: Reopen in Container).

Expected

Because the container is only being reopened and not created, the initializeCommand should not run and the corresponding logs shouldn't print.

Actual

The initializeCommand is run and the logs are printed.

Help would be much appreciated!

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

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.

More from microsoft/vscode-remote-release

All issues in microsoft/vscode-remote-release

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.