Skip to content

postCreateCommand is never executed with mcr.microsoft.com/devcontainers/base:ubuntu26.04 #1949

Description

TL;DR
The problem wasn't with the image itself, but with the changes made to Ubuntu 26.04, and a series of coincidences.

Symptom

When using "image": "mcr.microsoft.com/devcontainers/base:ubuntu26.04", (or "image": "mcr.microsoft.com/devcontainers/base:ubuntu",) with postCreateCommand configured, the configured command does not run.

Reproduction

  1. Create a new repository
  2. Create a new folder named .devcontainer
  3. Create a file named devcontainer.json in .devcontainer with:
{
    "name": "Test",
    "image": "mcr.microsoft.com/devcontainers/base:ubuntu26.04",
    "postCreateCommand": "bash .devcontainer/post-create.sh"
}
  1. Create a file named post-create.sh in .devcontainer with:
#!/bin/bash

echo "Hello"
touch hello.txt
echo "done"
  1. Reopen in container and Show container log
  2. Verify that the post-create.sh never runs, and hello.txt is not there
  3. Modify image in devcontainer.json:
{
    "name": "Test",
    "image": "mcr.microsoft.com/devcontainers/base:ubuntu24.04",
    "postCreateCommand": "bash .devcontainer/post-create.sh"
}
  1. Rebuild container and Show container log
  2. Verify that the post-create.sh successfully runs and hello.txt appears

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions