Commit Graph
3 Commits
Author SHA1 Message Date
soreavis 7bc0562e38 feat(start): add --bind to publish the port on one host address (#90)
* feat(start): add --bind to publish the port on one host address

start published the API port with no host address, so it went on every
interface unless the runtime's default was changed, and the CLI had no
option to choose the address.

--bind ADDR publishes it on that address; on AWS it also sets
FLOCI_SERVICES_UI_BIND_ADDRESS so the web console follows. It is also a
profile key and a config profile create flag. The address is parsed as
one IP literal and passed on in one form, IPv4 dotted and IPv6 in full,
so docker and podman only see a form they read. A value that is not an
IP literal, an IPv6 zone or IPv4 not written dotted is refused with exit
2, before restart stops anything. The CLI still connects to 127.0.0.1,
so any address but 127.0.0.1 or 0.0.0.0 also needs --endpoint.

start records the address in a floci_bind label, and restart keeps it,
from the profile or else from that label. A container without the label
restarts without --bind: the addresses a runtime reports also hold its
own defaults (Podman's 0.0.0.0, default_host_ips), so they are not read
back.

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>

* fix(start): probe the --bind address in the port check

The port check before start bound the wildcard address. Linux refuses
that while another socket holds the port on 127.0.0.1, so start --bind
with a LAN address exited 1 on that port although the address was free.

With --bind the check now binds that address. When that works, the
port is free only if nothing answers there, since macOS and Windows let
the bind share the port with a listener on the wildcard. When it fails,
a bind on port 0 tells whether this machine has the address at all (the
error text cannot: Linux translates it). If it does not, docker judges
the address. If it does, the old rule decides, and below 1024 it asks
whether something answers on that address instead of on loopback.
Without --bind, or with --bind 0.0.0.0 or ::, the check is unchanged.

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>

---------

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>
2026-11-27 17:01:30 -06:00
soreavis 3c70876448 feat(start): add --security-opt so Floci can reach the socket on SELinux hosts (#70)
* feat(start): add --security-opt so Floci can reach the socket on SELinux hosts

With SELinux enforcing, as in the podman machine VM, the emulator
cannot connect to the mounted Podman socket: the kernel denies
connectto from container_t to the daemon's container_runtime_t, and
the web console fails with java.net.BindException: Permission denied.
Relabeling the mount with :z fixes access to the socket file but not
that check. --security-opt label=disable gets past it, and start had
no way to pass it.

The option is repeatable and goes to docker run unchanged. A restart
without --profile reads it back from the running container, like the
port, image and services; with --profile the start is rebuilt from
the profile, which has no key for it. docker inspect reports a
seccomp profile file inline, which docker run rejects, so such a
value fails start's validation, and with it the restart, before the
stop removes the container.

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>

* fix(start): keep --security-opt in retry and recovery commands

The failed-pull hint and the restart recovery command rebuild the
start from its flags, so they dropped --security-opt and a retry lost
label=disable. Carry it into both, shell-quoted.

The README's profile workaround stopped the default instance: name
the same profile and product on stop as on start.

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>

---------

Signed-off-by: soreavis <263610811+soreavis@users.noreply.github.com>
2026-11-05 14:25:35 -06:00
Hector Ventura 97eaa5e820 docs: add an exit-code table and generated --help snapshots (#63)
* docs: add an exit-code table and generated --help snapshots

README gains the exit codes scripts can rely on, per command. docs/help holds the --help text of every command in every tree, and HelpSnapshotTest fails when the files and the commands drift apart.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* docs: say which rejected values exit 1 and pin the documented exit codes with a test

The table promised 2 for every unusable value, but three commands report a rejected value with 1. The wording is narrowed, the three are named, and ExitCodeTableTest pins the rows that need neither Docker nor a server.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* test: keep the exit-code test off the developer's saved profiles

The profile commands build their own store under the home directory, so the test now runs with a temporary home.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-10-11 09:23:29 -05:00