fix(start): mount a relative --persist path as a directory and validate --port and --pull (#50)

* fix(start): mount a relative --persist path as a directory and validate --port and --pull

--persist ./data is resolved to an absolute path and created before docker run, so state lands in that directory instead of a Docker named volume; --port outside 1-65535 and an unknown --pull policy are rejected with exit 2 (restart checks them before stopping anything).

start creates the persist directory itself (preparePersistDir). restart now does that before it stops anything, so an unwritable directory fails the restart with the instance still running, instead of after the container was already removed.

* fix(start): leave a remote daemon's persist directory alone and accept pull policies in any locale

The persist directory is created only for a local daemon, an invalid path is reported instead of thrown while building the message, and pull policies are lowercased with Locale.ROOT. The permission test is skipped when permissions do not bind the user.

* fix(start): check the persist path for a remote daemon before restart stops anything

A remote daemon skips only the local directory creation. The path itself is resolved for every daemon, so an unusable one is reported before the stop instead of thrown while building the run arguments afterwards.

* test(restart): let the recorded start answer restart's pre-stop checks

The recording start used by the call-path tests was never parsed, so the new --pull validation rejected it. It now delegates the checks to the start restart really built.

* fix(start): pass a remote daemon's persist path on unchanged

A remote daemon's bind source is no longer resolved by the CLI machine's path rules, which turned /srv/data into a drive path on a Windows CLI. Only a local daemon has relative paths resolved.

* fix(start): refuse a relative --persist path for a remote daemon

A remote daemon cannot resolve a path relative to the CLI's working directory, and docker reads a bare name as a named volume, so the state would land somewhere a later restart does not carry over.

* refactor(start): keep bindSource's javadoc on the method
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-10 17:55:29 -05:00
1 parent f6cec794d7
commit 3ca4108498
4 files changed
+302 -3

No files matched your search

@@ -73,6 +73,11 @@ public class RestartCommand implements Callable<Integer> {
printer.error(invalid);
return 2;
}
String unwritable = start.preparePersistDir();
if (unwritable != null) {
printer.error(unwritable);
return 1;
}
if (!containerExists()) {
// Nothing to stop: start it, rather than failing on the stop.