+-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 565.57.01 Driver Version: 565.57.01 CUDA Version: 12.7 | |-----------------------------------------+------------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 Tesla T4 Off | 00000000:00:10.0 Off | 0 | | N/A 33C P0 25W / 70W | 5255MiB / 15360MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ | 1 Tesla T4 Off | 00000000:00:11.0 Off | 0 | | N/A 24C P8 9W / 70W | 3MiB / 15360MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | 0 N/A N/A 326540 C ...unners/cuda_v12/ollama_llama_server 5252MiB | +-----------------------------------------------------------------------------------------+
+-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 565.57.01 Driver Version: 565.57.01 CUDA Version: 12.7 | |-----------------------------------------+------------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 Tesla T4 Off | 00000000:00:10.0 Off | 0 | | N/A 24C P8 8W / 70W | 3MiB / 15360MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+ | 1 Tesla T4 Off | 00000000:00:11.0 Off | 0 | | N/A 25C P8 9W / 70W | 3MiB / 15360MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=========================================================================================| | No running processes found | +-----------------------------------------------------------------------------------------+
function load() { if [ ! -f "$1" ]; then echo "file not found: $1" exit 1 fi res=$(docker image load -i "$1" 2>/dev/null | grep "Loaded image:" || true) images=${res//Loaded image: /} for image in $images; do echo "-> loaded $image" if [ -z $REGISTRY ]; then continue fi cnt=$(echo "$image" | awk -F/ "{print NF-1}") name=$image case $cnt in 0) name="library/$image" ;; 1) ;; *) part=${image%/*} left=${part%/*} name=${image/$left\//} ;; esac docker image tag "$image" "$REGISTRY/$name" docker image push "$REGISTRY/$name" echo "=> pushed $image to $REGISTRY/$name" docker image rm "$REGISTRY/$name" docker image rm "$image" || true done }
cnt=$(grep -c $REGISTRY /etc/hosts || true) if [ "$cnt" -eq 0 ]; then REGISTRY="" elif [ "$PUSH_REGISTRY" = 0 ]; then REGISTRY="" fi
if [ -z "$1" ]; then files=$(find . -type f -name "*.tar.gz" | sort -u) for file in $files; do echo ">> found $file" load "$file" done else load "$1" fi
function save() { if [ ! -f "$1" ]; then echo "file not found: $1" exit 1 fi images=$(docker-compose -f "$1" config --images | sort -u) for image in $images; do name=${image////-} name=${name//:/_} if [ -f "$ROOT_DIR/images/$name.tar.gz" ]; then echo "-> exist $name.tar.gz, skip" continue fi docker image pull --platform linux/amd64 "$image" echo "=> save $image to $name.tar.gz" docker image save "$image" | gzip > "$ROOT_DIR/images/$name.tar.gz" done }
if [ -z "$1" ]; then files=$(find . -type f -name "docker-compose*.yaml" | sort -u) for file in $files; do echo ">> found $file" save "$file" done else save "$1" fi