garethr-docker
garethr-docker copied to clipboard
Issue with docker image remove
Hi,
My intention is to remove old docker images from machine.
Trying to use docker::image { 'base': ensure => 'absent' } I see its executing block but doesn't actually removes the image mentioned in it, i have verified using notify statements before and after.
Is their anyway i can see some logs or find out what could be the issue ? Please guide.
Could you give us some debugging info? We need 3 things to really help here:
- Before running puppet, run
docker images | grep <image_to_be_removed>and list the output here. - Then paste in the puppet manifest you are running
- Repeat step 1 and paste the results
Thanks for your comment. List of images on servers are docker images REPOSITORY TAG IMAGE ID CREATED SIZE poc-docker-dc-001.company.net:5000/rep v1.0 f59a1b14b12d 4 weeks ago 581.9 MB poc-docker-dc-001.company.net:5000/rep v0.1 3f112a053682 12 weeks ago 581.7 MB I am trying to remove image with below ID passed, so grep wont return anything as its a combination of Repository and Tag. docker images | grep poc-docker-dc-001.company.net:5000/rep:v0.1
docker rmi poc-docker-dc-001.company.net:5000/rep:v0.1 Works fine for me manually.
Please let me know if i am doing anything wrong ?
Code snippet from manifest
notify { "before versioncmp execution ${app_version} ${current_rep_app_version} " :}
if versioncmp("${app_version}", "${current_rep_app_version}") !=0 {
notify {" versioncmp executed and removing image ${oldImageVersion} " :}
docker::image { $oldImageVersion :
ensure => 'absent'
}
}
notify { " after versioncmp execution " :}
Please see its added at the end of manifest file.
Any update on this ?
Maybe this will help https://github.com/garethr/garethr-docker/pull/697 ?