garethr-docker icon indicating copy to clipboard operation
garethr-docker copied to clipboard

Issue with docker image remove

Open parnamis opened this issue 8 years ago • 4 comments

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.

parnamis avatar Dec 27 '16 19:12 parnamis

Could you give us some debugging info? We need 3 things to really help here:

  1. Before running puppet, run docker images | grep <image_to_be_removed> and list the output here.
  2. Then paste in the puppet manifest you are running
  3. Repeat step 1 and paste the results

LongLiveCHIEF avatar Dec 28 '16 15:12 LongLiveCHIEF

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.

parnamis avatar Dec 28 '16 15:12 parnamis

Any update on this ?

parnamis avatar Jan 05 '17 14:01 parnamis

Maybe this will help https://github.com/garethr/garethr-docker/pull/697 ?

gdubicki avatar Jun 13 '17 13:06 gdubicki