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
- Create a new repository
- Create a new folder named
.devcontainer
- 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"
}
- Create a file named
post-create.sh in .devcontainer with:
#!/bin/bash
echo "Hello"
touch hello.txt
echo "done"
Reopen in container and Show container log
- Verify that the
post-create.sh never runs, and hello.txt is not there
- Modify
image in devcontainer.json:
{
"name": "Test",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu24.04",
"postCreateCommand": "bash .devcontainer/post-create.sh"
}
Rebuild container and Show container log
- Verify that the
post-create.sh successfully runs and hello.txt appears
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",) withpostCreateCommandconfigured, the configured command does not run.Reproduction
.devcontainerdevcontainer.jsonin.devcontainerwith:{ "name": "Test", "image": "mcr.microsoft.com/devcontainers/base:ubuntu26.04", "postCreateCommand": "bash .devcontainer/post-create.sh" }post-create.shin.devcontainerwith:Reopen in containerandShow container logpost-create.shnever runs, andhello.txtis not thereimageindevcontainer.json:{ "name": "Test", "image": "mcr.microsoft.com/devcontainers/base:ubuntu24.04", "postCreateCommand": "bash .devcontainer/post-create.sh" }Rebuild containerandShow container logpost-create.shsuccessfully runs andhello.txtappears