#!/bin/bash # Define the container prefix CONTAINER="nc3_" # Define the volumes to create VOLUMES=( "db:local" "files:bind:./storage/data" "redis:local" "es_root:local" "es_index:local" "oo_data:local" "clamav:local" ) # Loop through the volumes and create them for volume in "${VOLUMES[@]}"; do # Split the volume definition into name, driver, and bind location IFS=: read -r name driver bind_location <<< "$volume" # Append the container prefix to the volume name volume_name="${CONTAINER}${name}" echo "Creating volume: $volume_name" # Create the volume based on the driver case $driver in local) #docker volume create "$volume_name" echo $volume_name ;; bind) if [ -z "$bind_location" ]; then echo "Error: Bind location not specified for volume: $volume_name" exit 1 fi # docker volume create --driver local --opt type=none --opt device=$bind_location --opt o=bind "$volume_name" echo docker volume create --driver local --opt type=none --opt device=$bind_location --opt o=bind "$volume_name" ;; *) echo "Error: Unknown driver: $driver for volume: $volume_name" exit 1 ;; esac done