diff --git a/internal/app/wwctl/container/exec/main.go b/internal/app/wwctl/container/exec/main.go index 6c54853d..69307473 100644 --- a/internal/app/wwctl/container/exec/main.go +++ b/internal/app/wwctl/container/exec/main.go @@ -18,6 +18,9 @@ func CobraRunE(cmd *cobra.Command, args []string) error { containerName := args[0] var allargs []string + if len(args) == 1 { + allargs = append(allargs, "/usr/bin/bash") + } if !container.ValidSource(containerName) { wwlog.Printf(wwlog.ERROR, "Unknown Warewulf container: %s\n", containerName) diff --git a/internal/app/wwctl/container/exec/root.go b/internal/app/wwctl/container/exec/root.go index a3022599..96f81b5c 100644 --- a/internal/app/wwctl/container/exec/root.go +++ b/internal/app/wwctl/container/exec/root.go @@ -9,13 +9,13 @@ import ( var ( baseCmd = &cobra.Command{ DisableFlagsInUseLine: true, - Use: "exec [OPTIONS] CONTAINER COMMAND", - Short: "Run a command inside of a Warewulf container", + Use: "exec [OPTIONS] CONTAINER COMMAND", + Short: "Run a command inside of a Warewulf container", Long: "Run a COMMAND inside of a warewulf CONTAINER.\n" + - "This is commonly used with an interactive shell such as /bin/bash\n" + + "This is commonly used with an interactive shell such as /bin/bash\n" + "to run a virtual environment within the container.", RunE: CobraRunE, - Args: cobra.MinimumNArgs(2), + Args: cobra.MinimumNArgs(1), ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { if len(args) != 0 { return nil, cobra.ShellCompDirectiveNoFileComp