2024-10-10 06:17:26 +02:00

19 lines
476 B
Bash
Executable File

#!/bin/bash
# Specify the image name and tag
IMAGE_NAME="myp-rp"
IMAGE_TAG="latest"
# Specify the output file name
OUTPUT_FILE="myp-rp_latest.tar.xz"
# Save the Docker image and compress it with xz
docker save ${IMAGE_NAME}:${IMAGE_TAG} | xz -z -T0 > ./${OUTPUT_FILE}
# Check if the operation was successful
if [ $? -eq 0 ]; then
echo "Image successfully saved and compressed to ${OUTPUT_FILE}"
else
echo "Error occurred while saving and compressing the image"
fi