You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the Unikraft Workshop we discovered that kraftkit does not give a proper error message on Arch LInux if Docker is not installed/started/we do not have the correct permissions.
Steps to reproduce
Install kraftkit-bin from the AUR and don't start docker beforehand
Expected behavior
An error message that docker needs to be started/installed/user has correct permissions
Which architectures were you using or does this bug affect?
x86_64
Which operating system were you using or does this bug affect?
linux/arch
Relevant log output
i use --as=kraftfile-runtime to skip this prompt in the future
Caught panic:
checked path: $XDG_RUNTIME_DIR
Restoring terminal...
goroutine 232 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:24 +0x5e
runtime/debug.PrintStack()
/usr/local/go/src/runtime/debug/stack.go:16 +0x13
github.com/charmbracelet/bubbletea.(*Program).recoverFromPanic(0xc000143900)
/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:705 +0x91
panic({0x1e63bc0?, 0xc00048d3f8?})
/usr/local/go/src/runtime/panic.go:770 +0x132
github.com/testcontainers/testcontainers-go/internal/core.MustExtractDockerHost.func1()
/go/pkg/mod/github.com/testcontainers/[email protected]/internal/core/docker_host.go:91 +0x66
sync.(*Once).doSlow(0xc000aabc30?, 0xc000aabc80?)
/usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
/usr/local/go/src/sync/once.go:65
github.com/testcontainers/testcontainers-go/internal/core.MustExtractDockerHost({0x2592198?, 0x37abcc0?})
/go/pkg/mod/github.com/testcontainers/[email protected]/internal/core/docker_host.go:88 +0x58
github.com/testcontainers/testcontainers-go/internal/core.NewClient({0x2592198, 0x37abcc0}, {0x0, 0x0, 0x0?})
/go/pkg/mod/github.com/testcontainers/[email protected]/internal/core/client.go:17 +0x88
github.com/testcontainers/testcontainers-go.NewDockerClientWithOpts({0x2592198, 0x37abcc0}, {0x0, 0x0, 0x0})
/go/pkg/mod/github.com/testcontainers/[email protected]/docker_client.go:117 +0x71
github.com/testcontainers/testcontainers-go.NewDockerProvider({0xc0007ab560, 0x2, 0x21c1d7f?})
/go/pkg/mod/github.com/testcontainers/[email protected]/provider.go:143 +0x10f
github.com/testcontainers/testcontainers-go.ProviderType.GetProvider(0x0, {0xc000aace28, 0x1, 0x586d1a?})
/go/pkg/mod/github.com/testcontainers/[email protected]/provider.go:114 +0x3e5
github.com/testcontainers/testcontainers-go.GenericContainer({_, _}, {{{{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...}, ...})
/go/pkg/mod/github.com/testcontainers/[email protected]/generic.go:59 +0x139
kraftkit.sh/initrd.(*dockerfile).Build(0xc000181c20, {0x25920b8, 0xc00071d6b0})
/__w/kraftkit/kraftkit/initrd/dockerfile.go:283 +0xad9
kraftkit.sh/internal/cli/kraft/utils.BuildRootfs.func1({0x25920b8?, 0xc00071d6b0?})
/__w/kraftkit/kraftkit/internal/cli/kraft/utils/rootfs.go:55 +0x63
kraftkit.sh/tui/processtree.(*ProcessTree).Init.(*ProcessTree).waitForProcessCmd.func2()
/__w/kraftkit/kraftkit/tui/processtree/processtree.go:334 +0x11a
github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1.1()
/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:324 +0x86
created by github.com/charmbracelet/bubbletea.(*Program).handleCommands.func1 in goroutine 227
/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:318 +0x139
E could not prepare deployment: could not package: could not package: could not build rootfs: program was killed: context canceled
The text was updated successfully, but these errors were encountered:
Update: I tracked down the code in their library and found this function deep down:
// MustExtractDockerHost Extracts the docker host from the different alternatives, caching the result to avoid unnecessary// calculations. Use this function to get the actual Docker host. This function does not consider Windows containers at the moment.// The possible alternatives are://// 1. Docker host from the "tc.host" property in the ~/.testcontainers.properties file.// 2. DOCKER_HOST environment variable.// 3. Docker host from context.// 4. Docker host from the default docker socket path, without the unix schema.// 5. Docker host from the "docker.host" property in the ~/.testcontainers.properties file.// 6. Rootless docker socket path.// 7. Else, because the Docker host is not set, it panics.funcMustExtractDockerHost(ctx context.Context) string {
dockerHostOnce.Do(func() {
cache, err:=extractDockerHost(ctx)
iferr!=nil {
panic(err)
}
dockerHostCache=cache
})
returndockerHostCache
}
Notice that on step 7 it says that it just panics if it doesn't find anything.
I will try to catch/interpret this to give out a better error, but there's nothing more that can be done.
craciunoiuc
added a commit
to craciunoiuc/kraftkit
that referenced
this issue
Feb 6, 2025
Describe the bug
During the Unikraft Workshop we discovered that kraftkit does not give a proper error message on Arch LInux if Docker is not installed/started/we do not have the correct permissions.
Steps to reproduce
Install kraftkit-bin from the AUR and don't start docker beforehand
Expected behavior
An error message that docker needs to be started/installed/user has correct permissions
Which architectures were you using or does this bug affect?
x86_64
Which operating system were you using or does this bug affect?
linux/arch
Relevant log output
The text was updated successfully, but these errors were encountered: