devcontainers / devcontainers/images

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

Open
#1,949 9 comments 0 reactions 1 assignee Claimed by @V-Subhankar-infy View on GitHub
Dominant language
Shell
Stars
2.1k
Forks
963
Avg merge
7h 48m
Merged PRs (30d)
11

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:
```json
{
"name": "Test",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu26.04",
"postCreateCommand": "bash .devcontainer/post-create.sh"
}

```
4. Create a file named `post-create.sh` in `.devcontainer` with:
```bash
#!/bin/bash

echo "Hello"
touch hello.txt
echo "done"

```
5. `Reopen in container` and `Show container log`
6. Verify that the `post-create.sh` never runs, and `hello.txt` is not there
7. Modify `image` in `devcontainer.json`:
```json
{
"name": "Test",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu24.04",
"postCreateCommand": "bash .devcontainer/post-create.sh"
}

```
8. `Rebuild container` and `Show container log`
9. Verify that the `post-create.sh` successfully runs and `hello.txt` appears

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.