Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Image is in use by a container" error during vagrant destroy when docker provider cannot remove in-use image #13563

Open
eszense opened this issue Jan 4, 2025 · 0 comments · May be fixed by #13564

Comments

@eszense
Copy link

eszense commented Jan 4, 2025

Context

Unexpected error during vagrant destroy regarding failure to remove in-use docker image has previously been fixed in #7245

Current Bug

The problem recur when Docker is connected to a podman backend.
This is because the slight difference in error text is not recognised.

Reproduction

  1. Create two identical project
projectA/
  Dockerfile
  Vagrantfile
projectB/
  Dockerfile
  Vagrantfile

Dockerfile:

FROM alpine
RUN touch /test

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.provider "docker" do |d|
    d.build_dir = "."
    d.remains_running = false
  end
end
  1. Run
cd projectA; vagrant up
cd ../projectB; vagrant up && vagrant destroy -f
  1. Current behavior: throws Error
A Docker command executed by Vagrant didn't complete successfully!
The command run along with the output from the command is shown
below.

Command: ["docker", "rmi", "52a6cd7780a1", {:notify=>[:stdout, :stderr]}]

Stderr: Error response from daemon: image 52a6cd7780a1 is in use: image used by 661ef8666be33d1b951cb1526d8b81636b1a807d707c77d00fb44ad2f6a7313e: image is in use by a container: consider listing external containers and force-removing image


Stdout: 

Environment

% vagrant -v
Vagrant 2.4.1

% docker version
Client:
 Version:           27.4.1
 API version:       1.41 (downgraded from 1.47)
 Go version:        go1.22.10
 Git commit:        b9d17ea
 Built:             Tue Dec 17 15:42:24 2024
 OS/Arch:           darwin/arm64
 Context:           default

Server: linux/arm64/fedora-40
 Podman Engine:
  Version:          5.0.3
@eszense eszense changed the title "Image is in use by a container" error during vagrant destroy "Image is in use by a container" error during vagrant destroy by docker provider Jan 4, 2025
@eszense eszense changed the title "Image is in use by a container" error during vagrant destroy by docker provider "Image is in use by a container" error during vagrant destroy when docker provider cannot remove in-use image Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant