envbuilder icon indicating copy to clipboard operation
envbuilder copied to clipboard

Unable to Delete Workspace: Conflict Error Due to Image Reference in Use by Another Container

Open techwithanirudh opened this issue 1 year ago • 2 comments

Issue:

When attempting to delete a workspace that uses the DevContainers Docker template, and another running container is using the same image, the deletion fails with the following error:

Error: Unable to remove Docker image: Error response from daemon: conflict: unable to remove repository reference "ghcr.io/coder/envbuilder:latest" (must force) - container xxxxxxx is using its referenced image xxxxxxx.

Steps to Reproduce:

  1. Create two workspaces, both using the DevContainers Docker template.
  2. Attempt to delete one workspace while the other is still running and using the same template.
  3. Observe the conflict error during the deletion process.

Workaround:

Attempting to delete the workspace after stopping the other running workspace succeeds.

Additonal Info:

Environment:

  • Coder Version: v2.16.0+683a720
  • OS: Linux (installed using the setup script)

techwithanirudh avatar Oct 14 '24 16:10 techwithanirudh

@techwithanirudh Can you reproduce this behaviour without Terraform (that is, by running two instances of Envbuilder in parallel)? I'm expecting that this is not the case, and this behaviour is related to the kreuzwerker/docker Terraform provider.

johnstcn avatar Oct 16 '24 08:10 johnstcn

@johnstcn Yes, I ran two Envbuilder instances in parallel. I tried stopping one, and there were no issues at all.

techwithanirudh avatar Oct 16 '24 12:10 techwithanirudh