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.yamltemplate 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"
Metadata
Release files for docker-snapshot 1.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| docker_snapshot-1.0.11.tar.gz | 6.7 kB | Without provenance | Details for docker_snapshot-1.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| docker_snapshot-1.0.11-py3-none-any.whl | Python 3 | none | any | Details for docker_snapshot-1.0.11-py3-none-any.whl |
Total release size: 14.7 kB
Release files / docker_snapshot-1.0.11.tar.gz
| Download URL | docker_snapshot-1.0.11.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1452fa2dca6b1fd611a50c19dc2d14d33e1adc956cbee34fa56e883dd8b4a7bd
|
|
BLAKE2b-256 checksum How to use checksums |
b524f6fc0bf63db286c1b627a08973aae791fd35ae2928609154e5f63ba7ada1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / docker_snapshot-1.0.11-py3-none-any.whl
| Download URL | docker_snapshot-1.0.11-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1246a0bd22577bef4a15d11efdadde2117bc1683ba0ac471bae156e47f8de75a
|
|
BLAKE2b-256 checksum How to use checksums |
79a21009167adc8dddf2203e2dccb002dfa38e55aec188ad56ea021bca2ed153
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Security for docker-snapshot 1.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.