Skip to content

docker: add nilrt-ctr.sh container management CLI#351

Open
Shreejit-03 wants to merge 1 commit into
ni:nilrt/master/nextfrom
Shreejit-03:docker_compose
Open

docker: add nilrt-ctr.sh container management CLI#351
Shreejit-03 wants to merge 1 commit into
ni:nilrt/master/nextfrom
Shreejit-03:docker_compose

Conversation

@Shreejit-03
Copy link
Copy Markdown
Contributor

@Shreejit-03 Shreejit-03 commented May 25, 2026

Changes

Add a Docker Compose configuration and nilrt-ctr.sh CLI for managing NILRT containers locally.

  1. docker-compose.yml — Defines two services (nilrt runmode and nilrt-slim) with shared configuration (privileged, healthcheck on niauth_daemon, macvlan networking via the external nilrt-net network). Supports scaling to run multiple container instances.
  2. nilrt-ctr.sh — A Bash CLI that wraps Docker and docker-compose to manage NILRT containers:
    • discover / list / find — enumerate managed containers with status and IP.
    • status — detailed system info (OS, network, services, installed NI software).
    • install / remove / update — package management via opkg with lock-wait.
    • set-feed — configure opkg package feeds.
    • scale — scale service instances via docker compose.
    • shell / exec / logs / rename — operational convenience commands.
    • Target resolution by container name, ID prefix, or numeric index from discover.

Requires the nilrt-net macvlan network to be created beforehand (via setup-nilrt-network.sh).

Justification

AB#3201995.

Testing

All commands were manually tested against running NILRT containers:

Command Test
discover | list | find Lists all managed containers with correct index, name, image, state, and IP
status | info <target> Displays container metadata, network, OS info, running services, and installed NI software
set-feed | feed <target|all> <YYYYQN> Writes correct feed entries to /etc/opkg/base-feeds.conf; verified with cat inside container
install <target> [--feed YYYYQN] <pkg...> Installs packages via opkg; verified with opkg list-installed
remove | uninstall <target> <pkg...> Removes packages; confirmed package no longer listed
update | upgrade [target|all] Runs opkg update && opkg upgrade on target(s)
rename | hostname <target> <name> Sets hostname inside container; verified with hostname
shell | ssh <target> Opens interactive bash session; ran fw_printenv to confirm identity
scale <service> <n> Scaled nilrt-slim to 3 instances; new containers joined macvlan network with unique IPs
log | logs <target> [lines] Shows expected log output with configurable line count
exec | run <target> <cmd> Executes arbitrary commands (for example cat /etc/natinst/share/lvrt.conf)

Additionally verified:

  • Target resolution works by container name, ID prefix, and numeric index
  • Error handling for invalid targets, missing arguments, and stopped containers
  • --feed flag on install sets feeds before installing

@Shreejit-03 Shreejit-03 requested a review from a team as a code owner May 25, 2026 11:38
@Shreejit-03 Shreejit-03 requested a review from a team May 25, 2026 11:39
Add a management CLI tool and docker-compose.yml for NILRT
containers. The script provides discovery, software
installation, feed configuration, and system status commands
for nilrt-runmode and nilrt-slim containers on a macvlan
network.

Features:
- Discover and list managed containers with status/IP
- Install/remove/update packages via opkg with lock-wait
- Set up feed configuration in /etc/opkg/base-feeds.conf
- Scale container instances via docker compose
- Target resolution by name, ID prefix, or numeric index

Requires: setup-nilrt-network.sh to create the nilrt-net
macvlan network before starting containers.

Signed-off-by: Shreejit C <shreejit.c@emerson.com>
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