GripDev
  • Home
  • Posts
  • Tags
  • About
  • |
LIGHT DARK

Generate docker images of specific size

Feb 24, 2020

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.

https://gist.github.com/lawrencegripper/5c25d5fdd13a3233144d87e972b52fb2

 
ps. I'm dyslexic, please let me know if you see errors, I sometimes miss them. Pulls/issues are welcome 🔧 © 2025 Lawrence Gripper.