GithubHelp home page GithubHelp logo

fahidnasir / docker-helper-scripts Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 3 KB

Shell scripts to automate docker related tasks

License: MIT License

Shell 100.00%
docker docker-volume data-containers

docker-helper-scripts's Introduction

1. Docker Helper Scripts

This repository contains shell scripts for docker to automate/help routine operations.

1.1. Pre-Requisites

  1. Make the shell files executable
    • Navigate to the folder
    • Run the command: chmod +x *.sh

1.2. List of Scripts

1.2.1. docker_volume_clone.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

1.2.1.1. Parameters

You can provide the following parameters as command line params or script will ask you to provide the value.

  1. SOURCE VOLUME
  2. DESTINATION VOLUME

1.2.1.2. Use Case

Before releasing a new version, copy all the files from the older volume to a new volume to attach it with the latest version.

1.2.1.3. How it works

  1. Check if parameters are provided
  2. Prompt for the missing parameter value(s)
  3. Check availability of Source volume (fails if doesn't exist)
  4. Check availability of Destination volume (fails if already exist)
  5. Create a data container from an official busybox image
    1. Mount both Source and Destination volumes into the container
    2. Run the copy command inside the data container to copy everything from source container to destination container.

1.2.2. docker_volume_get_info.sh

This script will list all the volumes with the attached stopped or running container IDs and disk space size.

./docker_volume_get_info.sh

1.2.2.1. Use Case

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.

1.2.2.2. How it works

This script use busybox to mount volume and calculate the size of folder inside the volume using du library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.