lirantal / dockly

Immersive terminal interface for managing docker containers and services

Home Page:https://lirantal.github.io/dockly/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Volume view

erikvullings opened this issue · comments

When toggling the view, you display containers, services, and images. Could you also show the volumes and allow me to delete them? And perhaps, open them so I can inspect their content (mount them using a temporary alpine container and log into that) and potentially change their content. Also, it would be useful if I could save a volume to a tar/zip file, and vice versa, to unpack it again to a volume.

For example, when working on a project, I have a database that I wish to share. It runs in the swarm and the backup is made to a volume. I would like to share that volume with team members, but this is rather cumbersome to copy its contents, zip it, send it, and put it back in a new volume. See the create_volume.sh script I use for that below. I would be very useful if dockly could assist in this...

#!/bin/bash

# Help function
display_help() {
    echo "Usage: ./create_volume.sh <volume_name> <source_directory>"
    echo ""
    echo "Arguments:"
    echo "  <volume_name>      Name for the Docker volume"
    echo "  <source_directory> Path to the source directory on the host machine (relative or absolute)"
}

# Check if help option is passed
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
    display_help
    exit 0
fi

# Check if at least two arguments are provided
if [ $# -lt 2 ]; then
    echo "Error: Invalid number of arguments"
    display_help
    exit 1
fi

# Arguments
volume_name=$1
source_directory=$2

# Create the volume (skipped if the volume already exists)
docker volume create "$volume_name" >/dev/null

# Create a temporary container to perform the copy
container_id=$(docker create -v "$volume_name:/target" alpine)

# Copy the data from the source directory to the volume using the container
docker cp "$source_directory/." "$container_id:/target"

# Remove the temporary container
docker rm "$container_id" >/dev/null

echo "Data copied successfully to the Docker volume."

Agree this would be a nice feature added :-)