From 36f4c5f26d60a97bbd08b182551378e4d1b76a35 Mon Sep 17 00:00:00 2001 From: fuleinist Date: Mon, 20 Apr 2026 12:09:45 +0800 Subject: [PATCH] fix/docker: use exec-form ENTRYPOINT so args pass to binary Problem: Shell-form ENTRYPOINT ["/bin/sh", "-c"] causes Docker to parse args as shell options instead of passing them to the server binary. Users calling 'docker run IMAGE --source wifi' see errors like: wifi: 1: --source: not found (PowerShell parsing) /bin/sh: 0: Illegal option -- (Docker shell dispatch) Fix: Switch to exec-form ENTRYPOINT ["/app/sensing-server"] so that arguments after the image name reach the binary directly. The server already reads CSI_SOURCE from the environment, so -e CSI_SOURCE=esp32 still works for environment-based configuration. Also update docker-compose.yml command to use exec-form JSON array so compose also passes args correctly. Fixes #384 References: #384 (can't start docker container on windows) --- docker/Dockerfile.rust | 13 +++++++++---- docker/docker-compose.yml | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docker/Dockerfile.rust b/docker/Dockerfile.rust index 73cc58a15..cf69bb1d8 100644 --- a/docker/Dockerfile.rust +++ b/docker/Dockerfile.rust @@ -50,7 +50,12 @@ ENV RUST_LOG=info # Override at runtime: docker run -e CSI_SOURCE=esp32 ... ENV CSI_SOURCE=auto -ENTRYPOINT ["/bin/sh", "-c"] -# Shell-form CMD allows $CSI_SOURCE to be substituted at container start. -# The ENV default above (CSI_SOURCE=auto) applies when the variable is unset. -CMD ["/app/sensing-server --source ${CSI_SOURCE} --tick-ms 100 --ui-path /app/ui --http-port 3000 --ws-port 3001"] +ENTRYPOINT ["/app/sensing-server"] +# Exec-form CMD allows arguments after the image name to reach the binary directly. +# Use -e CSI_SOURCE=... to control the data source at runtime. +# Examples: +# docker run ruvnet/wifi-densepose:latest # auto mode (default) +# docker run -e CSI_SOURCE=simulated ruvnet/wifi-densepose:latest # synthetic data +# docker run -e CSI_SOURCE=esp32 ruvnet/wifi-densepose:latest # real ESP32 hardware +# docker run ruvnet/wifi-densepose:latest --source simulated # equivalent to above +CMD [] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 436dc1988..56efc8506 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -18,8 +18,8 @@ services: # wifi — use host Wi-Fi RSSI/scan data (Windows netsh) # simulated — generate synthetic CSI data (no hardware required) - CSI_SOURCE=${CSI_SOURCE:-auto} - # command is passed as arguments to ENTRYPOINT (/bin/sh -c), so $CSI_SOURCE is expanded by the shell. - command: ["/app/sensing-server --source ${CSI_SOURCE:-auto} --tick-ms 100 --ui-path /app/ui --http-port 3000 --ws-port 3001"] + # command args are passed directly to the binary; CSI_SOURCE env var is read by the server. + command: ["/app/sensing-server", "--source", "${CSI_SOURCE:-auto}", "--tick-ms", "100", "--ui-path", "/app/ui", "--http-port", "3000", "--ws-port", "3001"] python-sensing: build: