Skip to content

Commit

Permalink
cmd/run: Adjust for changes in 'podman ps' in Podman 2.0
Browse files Browse the repository at this point in the history
The key containing the container's name (ie., "Names") is no longer a
string, but a slice of strings.

#509
  • Loading branch information
debarshiray committed Jul 23, 2020
1 parent 2aad838 commit 06ef424
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,13 @@ func runCommand(container string,
} else if containersCount == 1 && defaultContainer {
fmt.Fprintf(os.Stderr, "Error: container %s not found\n", container)

container = containers[0]["Names"].(string)
switch value := containers[0]["Names"].(type) {
case string:
container = value
case []interface{}:
container = value[0].(string)
}

fmt.Fprintf(os.Stderr, "Entering container %s instead.\n", container)
fmt.Fprintf(os.Stderr, "Use the 'create' command to create a different toolbox.\n")
fmt.Fprintf(os.Stderr, "Run '%s --help' for usage.\n", executableBase)
Expand Down

0 comments on commit 06ef424

Please sign in to comment.