This repository contains shell scripts for docker to automate/help routine operations.
- Make the shell files executable
- Navigate to the folder
- Run the command:
chmod +x *.sh
This will create a new destination volume and copy all the files from source to this new destination volume.
./docker_volume_clone.sh name_or_id_of_source_volume destination_volume_name
You can provide the following parameters as command line params or script will ask you to provide the value.
SOURCE VOLUME
DESTINATION VOLUME
Before releasing a new version, copy all the files from the older volume to a new volume to attach it with the latest version.
- Check if parameters are provided
- Prompt for the missing parameter value(s)
- Check availability of Source volume (fails if doesn't exist)
- Check availability of Destination volume (fails if already exist)
- Create a data container from an official busybox image
- Mount both Source and Destination volumes into the container
- Run the
copy command
inside the data container to copy everything from source container to destination container.
This script will list all the volumes with the attached stopped or running container IDs and disk space size.
./docker_volume_get_info.sh
Docker doesn't provide an API to get size of docker volume. So instead of running multiple commands, Conveniently get all available volume(s) information by running this single script.
This script use busybox to mount volume and calculate the size of folder inside the volume using du library.