Skip to content

feat: --instance flag for parallel container instances (v0.6.8)#61

Merged
ycpss91255 merged 1 commit into
mainfrom
feat/v0.6.8-instance-flag
Apr 9, 2026
Merged

feat: --instance flag for parallel container instances (v0.6.8)#61
ycpss91255 merged 1 commit into
mainfrom
feat/v0.6.8-instance-flag

Conversation

@ycpss91255
Copy link
Copy Markdown
Contributor

Summary

Adds optional --instance NAME to run.sh/exec.sh/stop.sh so you can run multiple containers from the same repo in parallel without name collision.

Usage

# Default (unchanged)
./run.sh                     # container = lidar_filter_kinetic
./exec.sh bash               # enters it
./stop.sh                    # stops it

# Parallel instance
./run.sh --instance dev2     # container = lidar_filter_kinetic-dev2 (separate project)
./exec.sh --instance dev2    # enters that one
./stop.sh --instance dev2    # stops only dev2
./stop.sh --all              # stops default + every named instance

Design

  • Default invocation unchanged — container = ${IMAGE_NAME}, ci.sh and other tools that grep docker exec ${IMAGE_NAME} continue to work
  • With --instance NAME — project name + container name get -NAME suffix, fully isolated docker compose project (own network, volumes)
  • compose.yaml uses container_name: ${IMAGE_NAME}${INSTANCE_SUFFIX:-} (template's init.sh-generated example updated; existing 17 consumer repos need a one-line edit before --instance works there)
  • Collision safety./run.sh (foreground devel) refuses if a container with the default name is already running. Caller must explicitly ./stop.sh or use --instance NAME
  • stop.sh --all — enumerates all compose projects matching ${DOCKER_HUB_USER}-${IMAGE_NAME}* via docker labels and downs each

Test plan

  • 213/213 tests pass (12 new for flag/env/help/collision)
  • CI green
  • Integration-e2e job still passes (verifies init.sh-generated compose.yaml builds OK)

Note for consumer repos

Existing 17 repos must update compose.yaml:

-    container_name: ${IMAGE_NAME}
+    container_name: ${IMAGE_NAME}${INSTANCE_SUFFIX:-}

Backward compatible — default behavior unchanged until they upgrade.

🤖 Generated with Claude Code

Adds optional --instance NAME to run/exec/stop scripts, enabling multiple
parallel containers from the same repo without name collision.

Design:
- Default invocation unchanged: container = ${IMAGE_NAME}, project name
  = ${DOCKER_HUB_USER}-${IMAGE_NAME}
- With --instance dev2: container = ${IMAGE_NAME}-dev2, project name
  = ${DOCKER_HUB_USER}-${IMAGE_NAME}-dev2 → fully isolated network/volumes
- compose.yaml's container_name now uses ${IMAGE_NAME}${INSTANCE_SUFFIX:-}
  so default keeps the clean name (preserves external `docker exec
  ${IMAGE_NAME}` patterns) and named instances get a -NAME suffix
- run.sh foreground devel refuses to start if default container already
  running (caller must explicit ./stop.sh or use --instance)
- stop.sh gains --instance and --all flags. --all enumerates all matching
  compose projects via docker ps label and downs each

213 tests total (was 201): 12 new unit tests for flag parsing, env passing,
help text, and collision refusal.

Note: existing 17 consumer repos need a one-line compose.yaml update to
use ${IMAGE_NAME}${INSTANCE_SUFFIX:-} before --instance works there.
Default behavior is fully backward-compatible until they upgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 12.50000% with 49 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
script/docker/stop.sh 18.51% 22 Missing ⚠️
script/docker/run.sh 5.00% 19 Missing ⚠️
script/docker/exec.sh 11.11% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@ycpss91255 ycpss91255 merged commit f8afa93 into main Apr 9, 2026
3 of 4 checks passed
@ycpss91255 ycpss91255 deleted the feat/v0.6.8-instance-flag branch April 9, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant