diff --git a/docker_squash/image.py b/docker_squash/image.py index 82127ec..3039d50 100644 --- a/docker_squash/image.py +++ b/docker_squash/image.py @@ -186,11 +186,12 @@ def _before_squashing(self): try: number_of_layers = int(self.from_layer) - self.log.debug("We detected number of layers as the argument to squash") + self.log.debug( + f"We detected number of layers ({number_of_layers}) as the argument to squash" + ) except ValueError: - self.log.debug("We detected layer as the argument to squash") - squash_id = self._squash_id(self.from_layer) + self.log.debug(f"We detected layer ({squash_id}) as the argument to squash") if not squash_id: raise SquashError( diff --git a/docker_squash/squash.py b/docker_squash/squash.py index 03c3b0a..11840d7 100644 --- a/docker_squash/squash.py +++ b/docker_squash/squash.py @@ -143,8 +143,11 @@ def squash(self, image: Image): # Load squashed image into Docker image.load_squashed_image() - # Clean up all temporary files - image.cleanup() + # If development mode is not enabled, make sure we clean up the + # temporary directory + if not self.development: + # Clean up all temporary files + image.cleanup() # Remove the source image - this is the only possible way # to remove orphaned layers from Docker daemon at the build time. diff --git a/docker_squash/v2_image.py b/docker_squash/v2_image.py index 3baee28..861b0bd 100644 --- a/docker_squash/v2_image.py +++ b/docker_squash/v2_image.py @@ -16,9 +16,6 @@ class V2Image(Image): def _before_squashing(self): super(V2Image, self)._before_squashing() - # New OCI Archive format type - self.oci_format = True - # Read old image manifest file self.old_image_manifest = self._get_manifest() self.log.debug( @@ -378,6 +375,8 @@ def _generate_image_metadata(self): def _get_manifest(self): if os.path.exists(os.path.join(self.old_image_dir, "index.json")): + # New OCI Archive format type + self.oci_format = True # Not using index.json to extract manifest details as while the config # sha could be extracted via some indirection i.e. #