Make container name optional in console command

When omitted, tries: 1) same name as stack, 2) 'app'.
So 'portainer-cli console librarian' resolves to librarian-librarian-1,
and 'portainer-cli console myapp' falls back to myapp-app-1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 14:06:56 +01:00
parent 948910fc87
commit 382ba15f15
2 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ module PortainerCli
portainer-cli list networks <endpoint-id> List networks
portainer-cli create stack --endpoint ID --name NAME --file FILE
portainer-cli create container --endpoint ID --image IMAGE [--name NAME] [--port h:c] [--env K=V]
portainer-cli console <stack> <container> Open interactive shell (resolves endpoint automatically)
portainer-cli console <stack> [container] Open interactive shell (resolves endpoint automatically)
--shell SHELL Shell to use (default: /bin/sh)
portainer-cli exec <endpoint-id> <container> Open interactive shell (manual endpoint)
--shell SHELL Shell to use (default: /bin/sh)