Created
June 2, 2020 23:43
-
-
Save jaymody/b6ea54e2fb458bdf3d04be01decf9d4d to your computer and use it in GitHub Desktop.
docker save with a progress bar
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
# If you're impatient like me, a progress bar can be a comforting way to impulsively check the progress | |
# of your docker save command | |
# | |
# You'll need tqdm installed (https://github.com/tqdm/tqdm) for this to work. | |
docker save IMAGE_NAME | tqdm --bytes --total $(docker image inspect IMAGE_NAME --format='{{.Size}}') > OUTPUT_TAR_NAME |
Great script, really helpful! 👍
I created a snippet that includes a Dockerized version of tqdm and gzip, for better file size and portability.
#!/usr/bin/env bash
DOCKER_IMAGE=python:3.13.0-alpine3.20
DOCKER_IMAGE_SIZE=$(docker image inspect "${DOCKER_IMAGE}" --format='{{.Size}}')
OUTPUT_FILE='/tmp/image.tgz'
docker save ${DOCKER_IMAGE} |
docker run --rm -i tqdm/tqdm:latest --bytes --total ${DOCKER_IMAGE_SIZE} |
gzip >${OUTPUT_FILE}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works with docker commit as well. +1