cleanup_unused_images.yml 872 B

12345678910111213141516171819202122
  1. ---
  2. - name: Check Docker image count
  3. shell: "docker images -aq | wc -l"
  4. register: docker_image_count
  5. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  6. - debug: var=docker_image_count.stdout
  7. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  8. - name: Remove unused Docker images for Docker 1.10+ migration
  9. shell: "docker rmi `docker images -aq`"
  10. # Will fail on images still in use:
  11. failed_when: false
  12. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  13. - name: Check Docker image count
  14. shell: "docker images -aq | wc -l"
  15. register: docker_image_count
  16. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool
  17. - debug: var=docker_image_count.stdout
  18. when: docker_upgrade_nuke_images is defined and docker_upgrade_nuke_images | bool