For some testing I’m doing I need a set of images of a specific size to simulate pulling larger vs smaller image.
Here is a quick script I put together for generating a 200mb, 600mb, 1000mb and 2000mb image (tiny bit larger as alpine included). Took a while to work out best to use /dev/urandom
not /dev/zero
as with zero
the images got compressed for transfer.

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -x | |
# Push 200mb image | |
dd if=/dev/urandom of=./file.bin bs=1M count=200 | |
docker build -t lawrencegripper/big:200mb . | |
docker push lawrencegripper/big:200mb | |
rm ./file.bin | |
# Push 600mb image | |
dd if=/dev/urandom of=./file.bin bs=1M count=600 | |
docker build -t lawrencegripper/big:600mb . | |
docker push lawrencegripper/big:600mb | |
rm ./file.bin | |
# Push 1000mb image | |
dd if=/dev/urandom of=./file.bin bs=1M count=1000 | |
docker build -t lawrencegripper/big:1000mb . | |
docker push lawrencegripper/big:1000mb | |
rm ./file.bin | |
# Push 2000mb image | |
dd if=/dev/urandom of=./file.bin bs=1M count=2000 | |
docker build -t lawrencegripper/big:2000mb . | |
docker push lawrencegripper/big:2000mb | |
rm ./file.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine | |
COPY ./file.bin . |