最後活躍 1712091017

修訂 dce93655134beaf619060cf76e26aa169ddc0b2d

docker-copy-volume.sh 原始檔案
1#!/bin/bash
2
3# Check if the required arguments are provided
4if [ $# -ne 2 ]; then
5 echo "Usage: $0 <volume_id> <destination>"
6 exit 1
7fi
8
9# Assign arguments to variables
10volume_id=$1
11destination=$2
12
13# Create a temporary container to mount the volume
14container_id=$(docker create -v $volume_id:/source_data --name temp_container busybox)
15
16# Copy the data from the volume to the destination
17docker cp $container_id:/source_data $destination
18
19# Remove the temporary container
20docker rm $container_id
21