Note: In the commands below the default Docker Compose project name
scenescapeis used. Adjust it accordingly if Intel® SceneScape is installed with another project name.
The volume names can be identified by looking for keywords in their names. Before running the commands below, set the environment variable in the shell:
VOL_KEYWORD=modelsfor the Models Volume.VOL_KEYWORD=sample-datafor the Sample-Data Volume.
Verify the Docker Volume exists:
# as a prerequisite, set the VOL_KEYWORD variable accordingly
VOLUME=$(docker volume ls --format "{{.Name}}" | grep "scenescape_vol-$VOL_KEYWORD" | head -n 1)
if [ -z "$VOLUME" ]; then
echo "Error: Volume with keyword '$VOL_KEYWORD' not found"
exit 1
fi
echo "Volume name: $VOLUME"docker run --rm -v "$VOLUME:/volume" alpine ls -la /volumedocker run --rm -v "$VOLUME:/volume" alpine <command> <arguments...>For example, to find JSON files within the volume:
docker run --rm -v "$VOLUME:/volume" alpine find /volume -name '*.json' -printdocker run --rm -it -v "$VOLUME:/volume" alpine sh -c "cd /volume && sh"docker run --rm -v "/path/to/local/directory:/source" -v "$VOLUME:/volume" alpine cp /source/local.file /volume/destination_path/destination.fileAfter the copy operation completes, verify the file transfer by listing the volume contents to check the files.
Note: In the commands below the default namespace
scenescapeis used. Adjust it accordingly if the Intel® SceneScape chart is installed in another namespace.
Prerequisites: The commands in this section require
jqfor JSON processing. Install it using your system package manager:apt install jq,yum install jq, orbrew install jq.
The volume names can be identified by looking for keywords in their names. Before running the commands below, set the environment variable in the shell:
VOL_KEYWORD=modelsfor the Models Volume.VOL_KEYWORD=sample-datafor the Sample-Data Volume.
Find the Persistent Volume Claim name (PVC):
# as a prerequisite, set the VOL_KEYWORD variable accordingly
VOLUME=$(kubectl get pvc -n scenescape | grep $VOL_KEYWORD | head -n 1 | awk '{ print $1 }')
echo "Volume name: $VOLUME"Find the Pod that has the volume mounted
First, list all pods that mount the volume:
echo "Pods that mount volume $VOLUME:"
kubectl get pods -n scenescape -o wide --no-headers | awk '{print $1}' | while read pod; do
if kubectl get pod $pod -n scenescape -o jsonpath='{.spec.volumes[*].persistentVolumeClaim.claimName}' | grep -q "$VOLUME"; then
# Check if the volume mount name contains the keyword
READONLY=$(kubectl get pod $pod -n scenescape -o json | jq -r --arg keyword "$VOL_KEYWORD" '.spec.containers[].volumeMounts[] | select(.name | contains($keyword)) | .readOnly // false')
MOUNT_NAME=$(kubectl get pod $pod -n scenescape -o json | jq -r --arg keyword "$VOL_KEYWORD" '.spec.containers[].volumeMounts[] | select(.name | contains($keyword)) | .name')
echo " $pod (mount: $MOUNT_NAME, readOnly: $READONLY)"
fi
doneSelect a pod with proper access:
Choose a pod from the list above with proper access to the volume and copy-paste its name into the command below. For write access, choose a pod where readOnly is false or not set at all.
# Replace with the pod name that has readOnly: false
POD_NAME="<pod-name-with-write-access>"
echo "Pod name: $POD_NAME"Tip: For the Models Volume, web-app pods typically have write access. For the Sample-Data Volume, video pipeline pods usually have write access.
Identify the volume mount name:
Find the volume mount name by querying the pod specification for the volume that references our PVC:
VOLUME_MOUNT=$(kubectl get pod $POD_NAME -n scenescape -o json | jq -r '.spec.volumes[] | select(.persistentVolumeClaim.claimName=="'$VOLUME'") | .name')
echo "Volume mount name: $VOLUME_MOUNT"Identify the mount path of the volume:
MOUNT_PATH=$(kubectl get pod $POD_NAME -n scenescape -o json | jq -r '.spec.containers[].volumeMounts[] | select(.name=="'$VOLUME_MOUNT'") | .mountPath')
echo "Mount path: $MOUNT_PATH"kubectl exec -n scenescape $POD_NAME -- ls -la $MOUNT_PATHkubectl exec -n scenescape $POD_NAME -- <command> <arguments...>For example, to find JSON files within the volume:
kubectl exec -n scenescape $POD_NAME -- find $MOUNT_PATH -name '*.json' -printkubectl exec -it -n scenescape $POD_NAME -- /bin/sh -c "cd $MOUNT_PATH && /bin/sh"kubectl cp /path/to/local.file scenescape/$POD_NAME:$MOUNT_PATH/destination_path/destination.fileAfter the copy operation completes, verify the file transfer by listing the volume contents or executing a shell command to check the files.