diff --git a/php/EE/Migration/Containers.php b/php/EE/Migration/Containers.php index 9c9e77c4b..9336d6963 100644 --- a/php/EE/Migration/Containers.php +++ b/php/EE/Migration/Containers.php @@ -81,11 +81,25 @@ public static function save_upgraded_image_versions( $current_versions, $new_ver 'EE\Migration\Containers::revert_database_entry', [ $new_versions, $updated_images ], [ $current_versions, $updated_images ] + ); + self::$rsp->add_step( + 'prune-old-docker-images', + 'EE\Migration\Containers::image_cleanup', + null, + null, + null ); } + /** + * Prune old and extra EE Docker images. + */ + public static function image_cleanup() { + EE::exec( 'docker image prune -af --filter=label=org.label-schema.vendor="EasyEngine"' ); + } + /** * Update database entry of images *