kurtosis-tech / kurtosis

A platform for packaging and launching ephemeral backend stacks with a focus on approachability for the average developer.
https://docs.kurtosistech.com/
Apache License 2.0
313 stars 42 forks source link

panic when trying to start a kurtosis engine under docker #1848

Open gsmcwhirter opened 7 months ago

gsmcwhirter commented 7 months ago

What's your CLI version?

0.85.31

Description & steps to reproduce

When I try to start a kurtosis engine with kurtosis engine start, I get a panic with the stacktrace below. I believe this is due to the && instead of || at https://github.com/kurtosis-tech/kurtosis/blob/71bdab5be0faec0ae4e0a0a84792aecb6fe5e714/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/shared_helpers/shared_helpers.go#L427

Stacktrace:

DEBU[2023-11-24T17:26:24-05:00] Kurtosis config YAML filepath: '/Users/gsmcwhirter/Library/Application Support/kurtosis/kurtosis-config.yml'
DEBU[2023-11-24T17:26:24-05:00] Loaded Kurtosis Config  &{overrides:0xc0001494c0 shouldSendMetrics:false clusters:map[docker:0xc000149600 minikube:0xc000149640] cloudConfig:0xc0003b8f30}
DEBU[2023-11-24T17:26:24-05:00] Kurtosis config YAML filepath: '/Users/gsmcwhirter/Library/Application Support/kurtosis/kurtosis-config.yml'
DEBU[2023-11-24T17:26:24-05:00] Loaded Kurtosis Config  &{overrides:0xc0001498c0 shouldSendMetrics:false clusters:map[docker:0xc000149940 minikube:0xc0001499c0] cloudConfig:0xc0003b9320}
DEBU[2023-11-24T17:26:24-05:00] Connecting to Docker daemon via unix socket '/var/run/docker.sock'
INFO[2023-11-24T17:26:24-05:00] Starting Kurtosis engine from image 'kurtosistech/engine:0.85.31'...
DEBU[2023-11-24T17:26:24-05:00] Engine status: 'STOPPED'
INFO[2023-11-24T17:26:24-05:00] No Kurtosis engine was found; attempting to start one...
DEBU[2023-11-24T17:26:24-05:00] Metrics user id filepath: '/Users/gsmcwhirter/Library/Application Support/kurtosis/metrics-user-id'
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/shared_helpers.GetEngineAndLogsComponentsNetwork({0x101f75c30?, 0xc00012a008?}, 0x101bf3099?)
        /root/project/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/shared_helpers/shared_helpers.go:434 +0xc5
github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions.CreateEngine({0x101f75c30, 0xc00012a008}, {0x101c0a58b, 0x13}, {0x101bf63ff, 0x7}, 0x25ee, 0xc0004be300, 0xc0003ea3f0, {0x101f75f08, ...})
        /root/project/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/engine_functions/create_engine.go:71 +0x125
github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend.(*DockerKurtosisBackend).CreateEngine(0xc0004c4180?, {0x101f75c30?, 0xc00012a008?}, {0x101c0a58b?, 0x1018eac40?}, {0x101bf63ff?, 0x101c02d5f?}, 0xf?, 0x101bf1d9c?)
        /root/project/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/docker_kurtosis_backend.go:112 +0x65
github.com/kurtosis-tech/kurtosis/container-engine-lib/lib/backend_impls/metrics_reporting.(*MetricsReportingKurtosisBackend).CreateEngine(0x10190c3a0?, {0x101f75c30?, 0xc00012a008?}, {0x101c0a58b, 0x13}, {0x101bf63ff, 0x7}, 0x0?, 0x0?)
        /root/project/container-engine-lib/lib/backend_impls/metrics_reporting/metrics_reporting_kurtosis_backend.go:53 +0x55
github.com/kurtosis-tech/kurtosis/engine/launcher/engine_server_launcher.(*EngineServerLauncher).LaunchWithCustomVersion(0xc000278100, {0x101f75c30, 0xc00012a008}, {0x101bf63ff, 0x7}, 0x83f8a8?, 0xc0?, {0xc000261380, 0x40}, 0x0, ...)
        /root/project/engine/launcher/engine_server_launcher/engine_server_launcher.go:116 +0x211
github.com/kurtosis-tech/kurtosis/engine/launcher/engine_server_launcher.(*EngineServerLauncher).LaunchWithDefaultVersion(0xc0003cd200?, {0x101f75c30?, 0xc00012a008?}, 0x0?, 0x0?, {0xc000261380?, 0xc00083fa70?}, 0xab?, {0x101f5ee20, 0x102fdd540}, ...)
        /root/project/engine/launcher/engine_server_launcher/engine_server_launcher.go:51 +0xe5
github.com/kurtosis-tech/kurtosis/cli/cli/helpers/engine_manager.(*engineExistenceGuarantor).VisitStopped(0xc0001be0a0)
        /root/project/cli/cli/helpers/engine_manager/engine_existence_guarantor.go:155 +0x4f0
github.com/kurtosis-tech/kurtosis/cli/cli/helpers/engine_manager.EngineStatus.Accept({0x101bf6977?, 0x0?}, {0x101f684b0?, 0xc0001be0a0?})
        /root/project/cli/cli/helpers/engine_manager/engine_status.go:20 +0x75
github.com/kurtosis-tech/kurtosis/cli/cli/helpers/engine_manager.(*EngineManager).startEngineWithGuarantor(0xc000052460, {0x101f75c30, 0xc00012a008}, {0x101bf6977?, 0xc00083fc00?}, 0xc0001be0a0)
        /root/project/cli/cli/helpers/engine_manager/engine_manager.go:357 +0x65
github.com/kurtosis-tech/kurtosis/cli/cli/helpers/engine_manager.(*EngineManager).StartEngineIdempotentlyWithDefaultVersion(0xc000052460, {0x101f75c30?, 0xc00012a008}, 0x5, 0x0)
        /root/project/cli/cli/helpers/engine_manager/engine_manager.go:197 +0x327
github.com/kurtosis-tech/kurtosis/cli/cli/commands/engine/start.run(0x102f8c760?, {0xc000149000?, 0x0?, 0x2?})
        /root/project/cli/cli/commands/engine/start/start.go:92 +0x186
github.com/spf13/cobra.(*Command).execute(0x102f8c760, {0xc000148fc0, 0x2, 0x2})
        /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x102f8b340)
        /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
main.main()
        /root/project/cli/cli/main.go:52 +0x7d

Desired behavior

An engine is started

What is the severity of this bug?

Critical; I am blocked and Kurtosis is unusable for me because of this bug.

What area of the product does this pertain to?

CLI: the Command Line Interface

gsmcwhirter commented 7 months ago

After a bit more investigation, my docker setup is weird and I don't have a network named bridge. I also cannot create one (actually running podman w/ docker compatibility mode, not docker itself). It doesn't look like there is a way to change the name that kurtosis looks for, so this is a pretty hard blocker for me personally.

h4ck3rk3y commented 7 months ago

Hey @gsmcwhirter - I am gyani from Kurtosis. Thanks for filing thee bug! Can you tell me more about

  1. The version of podman you are using
  2. What operating system you are on

In all honesty - I haven't used KT with podman yet and I will ask the team if someone has. Based on 1/2 above I will create a test setup to verify whats going on

h4ck3rk3y commented 7 months ago

@gsmcwhirter

Did some digging

  1. Docker creates a default network called "bridge" by default; we have some constants that depend on the "bridge" network existing
  2. Podman's default network seems to be called "Podman" - I wonder if you can use podman network create to create a bridge network called bridge and then restart Kurtosis?

podman network create --driver bridge bridge

Based on how this goes - I will add some notes in our docs about Podman compatibility

gsmcwhirter commented 7 months ago

Thanks for the follow-ups. For reference, I am using podman-desktop 1.5.3 with underling podman 4.7.2 at the moment.

I had also discovered that the podman default network was named podman instead of bridge, and in trying to create one, I get the following:

$ podman network create --driver bridge bridge
Error: cannot create network with name "bridge" because it conflicts with a valid network mode