Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Unable to remove Docker image: image is referenced in multiple repositories #301

Open
stoically opened this issue Oct 21, 2020 · 1 comment

Comments

@stoically
Copy link

stoically commented Oct 21, 2020

Terraform Version

Terraform v0.13.3

Affected Resource(s)

  • docker_image

Terraform Configuration Files

data "docker_registry_image" "traefik" {
  name = "traefik:latest"
}

resource "docker_image" "traefik" {
  name          = data.docker_registry_image.traefik.name
  pull_triggers = [data.docker_registry_image.traefik.sha256_digest]
}

Expected Behavior

Should always silently upgrade the image / container

Actual Behavior

Error: Unable to remove Docker image: Error response from daemon: conflict: unable to delete 1a3f0281f41e (must be forced) - image is referenced in multiple repositories

Steps to Reproduce

Unfortunately not sure how to reproduce

Notes

Would it be safe to always force-remove images?

@simon-wessel
Copy link

simon-wessel commented Oct 28, 2020

This occurred for me when I had multiple tags referring to the same image (e.g. nginx:latest and nginx:1.19.3). I worked around the issue by manually force-deleting the image with docker rmi -f [image id]. You should probably stop other containers using that specific image first though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants