/Docker-Docker

Sources for a Docker image that provides a docker executable

Primary LanguageShellMIT LicenseMIT

Docker

Motivation

Primarily an image that provides a docker binary to control docker from within a container. For common tasks scripts are provided that may be used during execution.

Script Purpose
/usr/local/bin/backup-volume Backup one or more volumes
/usr/local/bin/restore-volume Restore one or more volumes from a backup

Inspirations

The volume backup/restore scripts are inspired by the following articles

Usage

Command Line

Arbitrary command

docker run \
  --rm \
  --init \
  -it \
  -v /var/run/docker.sock:/var/run/docker.sock \
  capybara1/docker:1.0 \
  my-command

Backup volume

docker run \
  --rm \
  --init \
  -it \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v my_vol1:/source/my_vol1 \
  -v my_vol2:/source/my_vol2 \
  -v /backup:/target \
  capybara1/docker:1.0 \
  /usr/local/bin/backup-volume --container=my_container my_vol1 my_vol2

Restore volume

docker run \
  --rm \
  --init \
  -it \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v /backup:/source \
  -v my_vol1:/target/my_vol1 \
  -v my_vol2:/target/my_vol2 \
  capybara1/docker:1.0 \
  /usr/local/bin/restore-volume --container=my_container my_vol1 my_vol2