Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: panic: rootless Docker not found with Colima on macos #2952

Open
kldavis4 opened this issue Jan 30, 2025 · 2 comments
Open

[Bug]: panic: rootless Docker not found with Colima on macos #2952

kldavis4 opened this issue Jan 30, 2025 · 2 comments
Labels
bug An issue with the library

Comments

@kldavis4
Copy link

Testcontainers version

0.35.0

Using the latest Testcontainers version?

Yes

Host OS

macos 14.7.1

Host arch

arm

Go version

1.22.5

Docker version

Client: Docker Engine - Community
 Version:           26.1.1
 API version:       1.45
 Go version:        go1.22.2
 Git commit:        4cf5afaefa
 Built:             Tue Apr 30 11:40:03 2024
 OS/Arch:           darwin/arm64
 Context:           colima

Server: Docker Engine - Community
 Engine:
  Version:          26.1.1
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.9
  Git commit:       ac2de55
  Built:            Tue Apr 30 11:48:47 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.31
  GitCommit:        e377cd56a71523140ca6ae87e30244719194a521
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Docker info

Client: Docker Engine - Community
 Version:    26.1.1
 Context:    colima
 Debug Mode: false
 Plugins:
WARNING: Plugin "/Users/kelly/.docker/cli-plugins/docker-buildx" is not valid: failed to fetch metadata: fork/exec /Users/kelly/.docker/cli-plugins/docker-buildx: no such file or directory
WARNING: Plugin "/Users/kelly/.docker/cli-plugins/docker-compose" is not valid: failed to fetch metadata: fork/exec /Users/kelly/.docker/cli-plugins/docker-compose: no such file or directory

Server:
 Containers: 32
  Running: 3
  Paused: 0
  Stopped: 29
 Images: 130
 Server Version: 26.1.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e377cd56a71523140ca6ae87e30244719194a521
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-31-generic
 Operating System: Ubuntu 24.04 LTS
 OSType: linux
 Architecture: aarch64
 CPUs: 4
 Total Memory: 7.738GiB
 Name: colima
 ID: a1e9f622-0328-4fdb-bf48-7f0bf8bbd1b6
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

What happened?

Test fails with error in the subject.

Exporting export DOCKER_HOST=unix:///Users/kelly/.colima/default/docker.sock fixes the issue.

This doesn't seem like it should be necessary given the documentation here. When I run docker context ls I get:

NAME       DESCRIPTION                               DOCKER ENDPOINT                                   ERROR
colima *   colima                                    unix:///Users/kelly/.colima/default/docker.sock   
default    Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                       
orbstack   OrbStack                                  unix:///Users/kelly/.orbstack/run/docker.sock 

Relevant log output

panic: rootless Docker not found

goroutine 1 [running]:
github.com/testcontainers/testcontainers-go/internal/core.MustExtractDockerHost.func1()
        /Users/kelly/projects/proxy/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_host.go:91 +0x78
sync.(*Once).doSlow(0x1?, 0x0?)
        /usr/local/go/src/sync/once.go:74 +0x100
sync.(*Once).Do(...)
        /usr/local/go/src/sync/once.go:65
github.com/testcontainers/testcontainers-go/internal/core.MustExtractDockerHost({0x102f879b0?, 0x1032e6460?})
        /Users/kelly/projects/proxy/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_host.go:88 +0x5c
github.com/testcontainers/testcontainers-go/internal/core.NewClient({0x102f879b0, 0x1032e6460}, {0x0, 0x0, 0x22900000000?})
        /Users/kelly/projects/proxy/vendor/github.com/testcontainers/testcontainers-go/internal/core/client.go:17 +0x9c
github.com/testcontainers/testcontainers-go.NewDockerClientWithOpts({0x102f879b0, 0x1032e6460}, {0x0, 0x0, 0x0})
        /Users/kelly/projects/proxy/vendor/github.com/testcontainers/testcontainers-go/docker_client.go:117 +0x4c
github.com/testcontainers/testcontainers-go.NewDockerProvider({0x14000120220, 0x2, 0x102dabb64?})
        /Users/kelly/projects/proxy/vendor/github.com/testcontainers/testcontainers-go/provider.go:143 +0x10c
github.com/testcontainers/testcontainers-go.ProviderType.GetProvider(0x0, {0x140002e4ed8, 0x1, 0x0?})
        /Users/kelly/projects/proxy/vendor/github.com/testcontainers/testcontainers-go/provider.go:114 +0x394
github.com/testcontainers/testcontainers-go.GenericContainer({_, _}, {{{{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...}, ...})
        /Users/kelly/projects/proxy/vendor/github.com/testcontainers/testcontainers-go/generic.go:59 +0xf0
github.com/vercel/proxy/services/metadata/vercelaws/dynamo.TestMain(0x1400052e3c0)
        /Users/kelly/projects/proxy/services/metadata/vercelaws/dynamo/dynamo_test.go:30 +0x198
main.main()
        _testmain.go:49 +0x170

Additional information

No response

@kldavis4 kldavis4 added the bug An issue with the library label Jan 30, 2025
@timrutte
Copy link

Same issue for me.

@myazinn
Copy link

myazinn commented Feb 14, 2025

Also got this error. These two lines fixed the issue for me

export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock
export DOCKER_HOST="unix://${HOME}/.colima/docker.sock"

Thanks to this thread testcontainers/testcontainers-java#5034 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with the library
Projects
None yet
Development

No branches or pull requests

3 participants