Docker export all images

Export all Docker images to files

#!/bin/bash

IMAGES=$(docker images | grep 'username-filter/' | grep -o '^\S*')

while IFS= read -r line; do
    FILENAME=$(printf '%s' "$line" | sed -n 's/username\///p')
    echo "Saving image \"$line:latest\" to \"$FILENAME.tar\"..."
    docker save "$line:latest" > "$FILENAME.tar"
done <<< "$IMAGES"