vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

Fallback to previous container if failing to build

Open antspy opened this issue 8 months ago • 2 comments

Hi,

I am using the devcontainers in VSCode. I am using the Dev Containers extension and running the Dev Containers: Rebuild Container command.

The problem is what happens when the build fails. Then you really don't have a dev environment anymore - you have to fix this problem, now, to be able to do your normal job - you can't decide to fix it later on in the day, everything is blocked until the issue is fixed. And if the fix is something outside of your control (e.g. a devcontainer feature fails to install, e.g. here), then you're in trouble - suddenly you have no dev environment anymore and you cannot write any code.

This is not a great position to be in. This issue can be partly addressed with devcontainers prebuilds (e.g. here), but only partly - there is still some code which runs on your machine which might cause the build to fail. Prebuilds are meant to speed up creation of devcontainers, but they're not there to ensure availability.

All this to say: I would like to be able to fallback to the latest container I was using if the latest rebuild fails. So that I can still do everything I need, I can still program and make progress, and at my leisure I can go and fix the devcontainer image.

Right now rebuilding the devcontainer is a leap of faith - if it does not work, you're stuck with no alternative. Would be nice if we could fallback to the latest image if the building fails (something like Dev Containers: Reuse latest available image or something like that).

Let me know what you think!

antspy avatar Apr 01 '25 19:04 antspy

Cross-linking https://github.com/orgs/devcontainers/discussions/209!

From that thread, I thought this sounds similar to a timeline view for dev container builds.

bamurtaugh avatar Apr 01 '25 20:04 bamurtaugh

Aa little offtopic but it could be useful on codespaces too.

I use the dind feature to define and update the devcontainer and it's dockerfile. (faster feedback loop doing a docker build -t test .devcontainer/ && docker run -ti test bash than rebuilding the devcontainer)

But there is no docker available in the default fallback image so if a rebuild fail, we're stuck in the rebuild devcontainer feedback loop.

A Fallback to previous working build would be helpful help. Or maybe updating the fallback image to have docker by default inside it would do the job too.

ggjulio avatar Dec 09 '25 18:12 ggjulio