-
-
Notifications
You must be signed in to change notification settings - Fork 584
Description
Testcontainers version
0.39.0
Using the latest Testcontainers version?
Yes
Host OS
macOS 26.0.1
Host arch
ARM
Go version
1.25.3
Docker version
$ docker version
Client:
Version: 28.5.1
API version: 1.51
Go version: go1.24.8
Git commit: e180ab8
Built: Wed Oct 8 12:16:17 2025
OS/Arch: darwin/arm64
Context: colima
Server: Docker Engine - Community
Engine:
Version: 28.4.0
API version: 1.51 (minimum version 1.24)
Go version: go1.24.7
Git commit: 249d679
Built: Wed Sep 3 20:58:55 2025
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0Docker info
$ docker info
Client:
Version: 28.5.1
Context: colima
Debug Mode: false
Plugins:
ai: Docker AI Agent - Ask Gordon (Docker Inc.)
Version: v1.9.11
Path: /Users/jmhodges/.docker/cli-plugins/docker-ai
buildx: Docker Buildx (Docker Inc.)
Version: v0.29.1
Path: /opt/homebrew/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 2.40.2
Path: /opt/homebrew/lib/docker/cli-plugins/docker-compose
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.45
Path: /Users/jmhodges/.docker/cli-plugins/docker-debug
desktop: Docker Desktop commands (Docker Inc.)
Version: v0.2.0
Path: /Users/jmhodges/.docker/cli-plugins/docker-desktop
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.31
Path: /Users/jmhodges/.docker/cli-plugins/docker-extension
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.4.0
Path: /Users/jmhodges/.docker/cli-plugins/docker-init
mcp: Docker MCP Plugin (Docker Inc.)
Version: v0.24.0
Path: /Users/jmhodges/.docker/cli-plugins/docker-mcp
model: Docker Model Runner (Docker Inc.)
Version: v0.1.46
Path: /Users/jmhodges/.docker/cli-plugins/docker-model
offload: Docker Offload (Docker Inc.)
Version: v0.5.1
Path: /Users/jmhodges/.docker/cli-plugins/docker-offload
sandbox: Docker Sandbox (Docker Inc.)
Version: v0.3.1
Path: /Users/jmhodges/.docker/cli-plugins/docker-sandbox
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /Users/jmhodges/.docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.18.3
Path: /Users/jmhodges/.docker/cli-plugins/docker-scout
Server:
Containers: 5
Running: 0
Paused: 0
Stopped: 5
Images: 3
Server Version: 28.4.0
Storage Driver: overlayfs
driver-type: io.containerd.snapshotter.v1
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
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
runc version: v1.2.5-0-g59923ef
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-64-generic
Operating System: Ubuntu 24.04.2 LTS
OSType: linux
Architecture: aarch64
CPUs: 2
Total Memory: 1.913GiB
Name: colima
ID: e88d1fcd-d1e2-4c00-bd57-eb42fab7ac7e
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: falseWhat happened?
When trying to create a postgres (or mariadb) database container with a colima 0.9.1 docker server on macOS 26.0.1, a panic happens deep in MustExtractDockerHost.
I followed the instructions for Colima (specifically the ones for versions of colima newer than 0.9.1).
That is, I ran docker context use colima and saw it correctly running.
Output of `docker context ls`
$ docker context ls
NAME DESCRIPTION DOCKER ENDPOINT ERROR
colima * colima unix:///Users/jmhodges/.colima/default/docker.sock
default Current DOCKER_HOST based configuration unix:///var/run/docker.sock
desktop-linux Docker Desktop unix:///Users/jmhodges/.docker/run/docker.sock
I then ran some example code. I've simplified it to this test:
func TestFoo(t *testing.T) {
s, err := run()
if err != nil {
t.Fatalf("Error: %s\n", err)
}
t.Logf("Connection string: %s\n", s)
}
func run() (string, error) {
ctx := context.Background()
container, err := postgres.Run(ctx,
"postgres:16-alpine",
postgres.WithDatabase("test"),
postgres.WithUsername("user"),
postgres.WithPassword("password"),
)
if err != nil {
return "", fmt.Errorf("failed to start Postgres container: %w", err)
}
connStr, err := container.ConnectionString(ctx)
if err != nil {
container.Terminate(ctx)
return "", fmt.Errorf("failed to get connection string: %w", err)
}
return connStr, nil
}$ go test -v -run Foo
=== RUN TestFoo
--- FAIL: TestFoo (0.00s)
panic: rootless Docker not found [recovered, repanicked]
goroutine 8 [running]:
testing.tRunner.func1.2({0x102e315c0, 0x140000107e0})
/opt/homebrew/Cellar/go/1.25.3/libexec/src/testing/testing.go:1872 +0x190
testing.tRunner.func1()
/opt/homebrew/Cellar/go/1.25.3/libexec/src/testing/testing.go:1875 +0x31c
panic({0x102e315c0?, 0x140000107e0?})
/opt/homebrew/Cellar/go/1.25.3/libexec/src/runtime/panic.go:783 +0x120
github.com/testcontainers/testcontainers-go/internal/core.MustExtractDockerHost.func1()
/Users/jmhodges/src/local/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_host.go:91 +0x68
sync.(*Once).doSlow(0x14000030000?, 0x0?)
/opt/homebrew/Cellar/go/1.25.3/libexec/src/sync/once.go:78 +0xe0
sync.(*Once).Do(...)
/opt/homebrew/Cellar/go/1.25.3/libexec/src/sync/once.go:69
github.com/testcontainers/testcontainers-go/internal/core.MustExtractDockerHost({0x102ee2308?, 0x10322d280?})
/Users/jmhodges/src/local/vendor/github.com/testcontainers/testcontainers-go/internal/core/docker_host.go:88 +0x54
github.com/testcontainers/testcontainers-go/internal/core.NewClient({0x102ee2308, 0x10322d280}, {0x0, 0x0, 0x0?})
/Users/jmhodges/src/local/vendor/github.com/testcontainers/testcontainers-go/internal/core/client.go:17 +0x88
github.com/testcontainers/testcontainers-go.NewDockerClientWithOpts({0x102ee2308, 0x10322d280}, {0x0, 0x0, 0x0})
/Users/jmhodges/src/local/vendor/github.com/testcontainers/testcontainers-go/docker_client.go:118 +0x4c
github.com/testcontainers/testcontainers-go.NewDockerProvider({0x14000262480, 0x2, 0x102cfe50e?})
/Users/jmhodges/src/local/vendor/github.com/testcontainers/testcontainers-go/provider.go:144 +0xfc
github.com/testcontainers/testcontainers-go.ProviderType.GetProvider(0x0, {0x140000ccfc8, 0x1, 0x0?})
/Users/jmhodges/src/local/vendor/github.com/testcontainers/testcontainers-go/provider.go:115 +0x784
github.com/testcontainers/testcontainers-go.GenericContainer({_, _}, {{{{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, ...}, ...}, ...})
/Users/jmhodges/src/local/vendor/github.com/testcontainers/testcontainers-go/generic.go:62 +0xe8
github.com/testcontainers/testcontainers-go/modules/postgres.Run({0x102ee2308, 0x10322d280}, {0x102d0196b?, 0x12?}, {0x140000cdec0, 0x3, 0x3?})
/Users/jmhodges/src/local/vendor/github.com/testcontainers/testcontainers-go/modules/postgres/postgres.go:186 +0x328
local.run()
/Users/jmhodges/src/local/foo_test.go:42 +0x118
local.TestFoo(0x140000fe700)
/Users/jmhodges/src/local/foo_test.go:33 +0x20
testing.tRunner(0x140000fe700, 0x102ed88f0)
/opt/homebrew/Cellar/go/1.25.3/libexec/src/testing/testing.go:1934 +0xc8
created by testing.(*T).Run in goroutine 1
/opt/homebrew/Cellar/go/1.25.3/libexec/src/testing/testing.go:1997 +0x364
exit status 2
FAIL local 0.414s
Setting the DOCKER_HOST explicitly gets you further, but not far enough.
$ env DOCKER_HOST=unix:///Users/jmhodges/.colima/default/docker.sock go test -v -run Foo
=== RUN TestFoo
2025/10/31 03:44:31 github.com/testcontainers/testcontainers-go - Connected to docker:
Server Version: 28.4.0
API Version: 1.51
Operating System: Ubuntu 24.04.2 LTS
Total Memory: 1959 MB
Testcontainers for Go Version: v0.39.0
Resolved Docker Host: unix:///Users/jmhodges/.colima/default/docker.sock
Resolved Docker Socket Path: /Users/jmhodges/.colima/default/docker.sock
Test SessionID: de6633547b5d706409a4866f17e360744751c288e1abe81b22581a16e2b4b9a3
Test ProcessID: e4ecc230-fc56-468d-abbd-27e72856b143
2025/10/31 03:44:31 🐳 Creating container for image postgres:16-alpine
2025/10/31 03:44:31 🐳 Creating container for image testcontainers/ryuk:0.13.0
2025/10/31 03:44:31 ✅ Container created: cddafa0468e5
2025/10/31 03:44:31 🐳 Starting container: cddafa0468e5
2025/10/31 03:44:31 🐳 Stopping container: cddafa0468e5
2025/10/31 03:44:31 🐳 Terminating container: cddafa0468e5
2025/10/31 03:44:31 🚫 Container terminated: cddafa0468e5
foo_test.go:35: Error: failed to start Postgres container: generic container: create container: reaper: new reaper: run container: container start: Error response from daemon: error while creating mount source path '/Users/jmhodges/.colima/default/docker.sock': mkdir /Users/jmhodges/.colima/default/docker.sock: operation not supported: could not start container
--- FAIL: TestFoo (0.13s)
FAIL
exit status 1
FAIL local 0.404s
Any idea what the correct way to talk to colima is? And possibly why it's different from other docker installations? Or is there something interesting about my colima server?
Relevant log output
Additional information
You'll notice I have a docker desktop install, but I shut it down before this.