`ds` is a development utility for managing snapshots inside a docker container.
Project description
ds - docker snapshot
ds
is a development utility for managing snapshots inside a docker container.
Personally I use it to quickly save the state of my development database, try out something that mutates the state - a data migration or user interaction - and return to the initial state. Often repeatedly, because trial and error is essential. You can probably use it on any sort of stored data, probably.
Note: This repository is still a work in progress.
Installing
# Note: executable will be called `ds`
pip install docker-snapshot
Shell completion:
# For Bash, add this to ~/.bashrc:
eval "$(_DS_COMPLETE=source_bash ds)"
# For Zsh, add this to ~/.zshrc:
eval "$(_DS_COMPLETE=source_zsh ds)"
Usage
Create a snapshot
ds create name-goes-here
# or auto-generate a name
ds create
Restore a snapshot
ds restore name-goes-here
# or restore the latest snapshot
ds restore
List snapshots
ds ls
Delete snapshots
ds delete name-goes-here
Example project setup
In this example we use ds
to create and restore database snapshots in our development environment. The projects docker-compose.yml
file could look something like this:
version: "3.8"
services:
db:
container_name: db
restart: always
image: postgres:13
env_file: .env
ports:
- 5432:5432
volumes:
- db-volume:/var/lib/postgresql/data
...
- Browse to your project root
cd code/your-awesome-project
- Create
ds.yaml
template file
ds init
- Edit your
ds.yaml
# The target container
container_name: "db"
# The directory inside said container that you want to snapshot
directory: "/var/lib/postgresql/data"
# Identifier to separate projects, this allows you:
# - To have multiple projects with the same container name
# - To have multiple setups (ie. docker-compose / kind) for the same project
namespace: "your-awesome-project"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for docker_snapshot-1.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30f87239d60eb85333f5295c5d20f8b1e8169bfce8af5369ba526d6767cdc0d3 |
|
MD5 | 56944886bcd85c7c336eaa8a16f78f68 |
|
BLAKE2b-256 | ff9d16fca873809ce60fdacbf6d976782bd6c9345153b031b17f13a49a62cab7 |