Selecting a compression algorithm for Packer images
Compression is not a simple yes or no option. There are several ways to compress an image based on the type of image and how itβs formatted. Some image types support native compression and some also support encryption. The order in which encryption and compression are performed on images is important. Compression takes patterns and simplifies repetition to save space. Encryption randomizes data and makes it hard to read. If you encrypt a disk during the build and then attempt to compress it, compression will not be able to reduce the image size because the data is scrambled by encryption. Also, if your OS provides its own disk compression, then recompressing will not save any size but will take much more time to decompress before usage. Various image formats have their own standards for encryption and compression:
- AMI: Optionally compressed and encrypted
- QCOW2: Optionally compressed
- VMDK: Optionally compressed...