providers/docker: be more lenient about deleting built image
This commit is contained in:
parent
8ed5351dd1
commit
d7ecd99e2e
|
@ -26,7 +26,10 @@ module VagrantPlugins
|
||||||
|
|
||||||
if image
|
if image
|
||||||
machine.ui.output(I18n.t("docker_provider.build_image_destroy"))
|
machine.ui.output(I18n.t("docker_provider.build_image_destroy"))
|
||||||
machine.provider.driver.rmi(image)
|
if !machine.provider.driver.rmi(image)
|
||||||
|
machine.ui.detail(I18n.t(
|
||||||
|
"docker_provider.build_image_destroy_in_use"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if image_file && image_file.file?
|
if image_file && image_file.file?
|
||||||
|
|
|
@ -104,7 +104,9 @@ module VagrantPlugins
|
||||||
|
|
||||||
def rmi(id)
|
def rmi(id)
|
||||||
execute('docker', 'rmi', id)
|
execute('docker', 'rmi', id)
|
||||||
|
return true
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
|
return false if e.to_s.include?("is using it")
|
||||||
raise if !e.to_s.include?("No such image")
|
raise if !e.to_s.include?("No such image")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,10 @@ en:
|
||||||
Image is already built from the Dockerfile. `vagrant reload` to rebuild.
|
Image is already built from the Dockerfile. `vagrant reload` to rebuild.
|
||||||
build_image_destroy: |-
|
build_image_destroy: |-
|
||||||
Removing built image...
|
Removing built image...
|
||||||
|
build_image_destroy_in_use: |-
|
||||||
|
Build image couldn't be destroyed because the image is in use. The
|
||||||
|
image must be destroyed manually in the future if you want to remove
|
||||||
|
it.
|
||||||
build_image_invalid: |-
|
build_image_invalid: |-
|
||||||
Build image no longer exists. Rebuilding...
|
Build image no longer exists. Rebuilding...
|
||||||
building: |-
|
building: |-
|
||||||
|
|
Loading…
Reference in New Issue