balena-cli
balena-cli copied to clipboard
List containers/services running on a device
I can see the number of containers running on a device with balena scan
which is great. However, if I want to list these containers so I can then SSH into one of them I have to know what they are called. I think having the ability to list all the containers/services would allow a lot more users to easily manage their devices and their services.
I'd say this is a very high quality of life improvement feature to have unless there are other ways of achieving the same result which is SSH into a devices containers without knowing nothing about the code/device itself and just using the CLI.
unless there are other ways of achieving the same result which is SSH into a devices containers without knowing nothing about the code/device itself and just using the CLI
I agree we should make it easier, but here's a workaround:
$ sudo balena scan
Reporting scan results
host: dcbff32.local
Then: (scroll horizontally to see the last column...)
$ echo balena-engine ps | balena ssh dcbff32.local
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7e2889d0bd4b 4c538128649d "/bin/sh -c 'i=1; wh…" 25 hours ago Up 26 hours bar_2193751_1351528
1b2e276f0478 93bc9248d7e5 "/bin/sh -c 'i=1; wh…" 25 hours ago Up 26 hours foo_2193750_1351528
015bdcb40fc9 balena/aarch64-supervisor:v10.8.0 "./entry.sh" 26 hours ago Up 55 seconds (health: starting) resin_supervisor
Ah, that is a way to do it! I wasn't aware of balena-engine CLI. I think that is a suitable work around tbh but if there was a way to know about it that would help.
I wasn't aware of balena-engine CLI
It is the balenaEngine (web, github), balena's IoT-enhanced Docker, and all Docker commands are available as balena-engine
commands, including docker ps
/ balena-engine ps
.
Important distinction about this issue is, balena scan
does not list the containers, just the number. This makes it annoying to spawn a shell in the container you want after scanning since you have to ssh into the host than query the engine for containers than spawn a shell with something like balena exec -it <container> sh
.
This issue is made worse with the fact that the container name used when talking directly to the engine must be the container name the engine has and not the dashboard (the dashboard will say grocy
while the engine knows it as grocy_<app_id>
)