compose: fix server command structure (critical bug)

Compose shlex-splits 'command: |' block scalar into a list when used with
'entrypoint: ["/bin/sh","-c"]'. Docker then runs '/bin/sh -c exec' where
'exec' is the only -c argument and '/app/llama-server' becomes $0. 'exec'
with no program in sh exits 0 immediately → 37-restart crash-loop, no server.

Fix: use 'entrypoint: []' and 'command: [/bin/sh, -c, <|block>]' so the full
shell command is passed as a single list element — not further split by Compose.
This commit is contained in:
2026-05-06 23:31:12 +02:00
parent e7e389c0e1
commit 322364e6fc

View File

@@ -67,19 +67,26 @@ x-server: &server
soft: -1 soft: -1
hard: -1 hard: -1
restart: unless-stopped restart: unless-stopped
entrypoint: ["/bin/sh", "-c"] # NOTE: command must be a list with the shell as explicit elements — do NOT use
command: | # `entrypoint: ["/bin/sh","-c"]` + `command: |` block scalar, because Compose
exec /app/llama-server \ # shlex-splits the block scalar into a list and Docker then passes only "exec"
--model "/models/$$MODEL_FILE" \ # as the -c argument (the rest become $0, $1 … → instant exit 0).
--host 0.0.0.0 --port 8080 \ entrypoint: []
--n-gpu-layers $$N_GPU_LAYERS \ command:
--ctx-size $$CTX_SIZE \ - /bin/sh
--threads $$THREADS --threads-batch $$THREADS_BATCH \ - -c
--batch-size $$BATCH_SIZE --ubatch-size $$UBATCH_SIZE \ - |
--cache-type-k $$CACHE_TYPE_K --cache-type-v $$CACHE_TYPE_V \ exec /app/llama-server \
--cont-batching --parallel $$PARALLEL \ --model "/models/$$MODEL_FILE" \
$$EXTRA_ARGS \ --host 0.0.0.0 --port 8080 \
--log-disable --n-gpu-layers $$N_GPU_LAYERS \
--ctx-size $$CTX_SIZE \
--threads $$THREADS --threads-batch $$THREADS_BATCH \
--batch-size $$BATCH_SIZE --ubatch-size $$UBATCH_SIZE \
--cache-type-k $$CACHE_TYPE_K --cache-type-v $$CACHE_TYPE_V \
--cont-batching --parallel $$PARALLEL \
$$EXTRA_ARGS \
--log-disable
networks: networks:
llama-net: llama-net:
aliases: [llama-current] aliases: [llama-current]