kiri import copies a volume while a running container is writing to it, and reports done

Open
#345 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
docker, rust
Domain
backend, cli

Research direction

Start by reading crates/kiri/src/import.rs and the volume() function identified in the issue; trace how it selects and copies a source volume. Check how the CLI invokes Docker for the source context and how volume import behavior is tested. Done means an import detects a running container using the volume and warns or stops before copying, with a documented --force option if that approach is chosen.

Written by the indexing model from the issue text.

Description

bug
Kiri version and system

0.2.1 on macOS 27.0.1 (Apple silicon, arm64); source OrbStack 2.2.5

What you did

A container on OrbStack keeps writing to a named volume, and I import that volume into Kiri while it runs:

docker --context orbstack volume create inuse-demo
docker --context orbstack run -d --name inuse-writer -v inuse-demo:/d alpine \
  sh -c 'i=0; while true; do i=$((i+1)); echo $i >> /d/log; done'
sleep 3
kiri import orbstack volume inuse-demo
docker --context kiri run --rm -v inuse-demo:/d alpine sh -c 'echo "kiri copy:  $(wc -l < /d/log) lines"'
docker --context orbstack stop -t1 inuse-writer
docker --context orbstack run --rm -v inuse-demo:/d alpine sh -c 'echo "source now: $(wc -l < /d/log) lines"'
What happened
volume inuse-demo: done
kiri copy:  1282471 lines
source now: 2237809 lines
What you expected instead

When a running container on the source mounts the volume, kiri import warns or stops before copying (for example: "inuse-writer is running with this volume; stop it first, or pass --force"). As it is, the import says done and the copy is a snapshot taken mid-write, with no sign that it may be incomplete. For a database volume (Postgres, MariaDB) that copy can be inconsistent, and nothing tells you.

Anything else

Without a running writer the import is exact: for a stopped volume with a 5 MB random file and a file owned 1234:5678 mode 640, sha256 and owner/mode match on both sides.

The check could live in crates/kiri/src/import.rs volume(): docker --context <source> ps --filter volume=NAME --filter status=running. Happy to send a pull request if that direction suits you; not starting on code before you say so, per CONTRIBUTING.

Dominant language
Rust
Stars
7.5k
Forks
329
Avg merge
7h 48m
Merged PRs (30d)
105

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libracoder/kiri

All issues in libracoder/kiri

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.