testcontainers / testcontainers/testcontainers-go

[Bug]: basic clickhouse ping failed

Open
#3,871 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
5k
Forks
637
Avg merge
2d 12h
Merged PRs (30d)
26

Description

Testcontainers version

0.44.0

Using the latest Testcontainers version?

Yes

Host OS

Windows

Host arch

x86

Go version

1.26

Docker version
$ docker version
Client:
 Version:           29.1.3
 API version:       1.52
 Go version:        go1.25.5
 Git commit:        f52814d
 Built:             Fri Dec 12 14:48:47 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Desktop 4.55.0 (213807)
 Engine:
  Version:          29.1.3
  API version:      1.52 (minimum version 1.44)
  Go version:       go1.25.5
  Git commit:       fbf3ed2
  Built:            Fri Dec 12 14:49:51 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.2.0
  GitCommit:        1c4457e00facac03ce1d75f7b6777a7a851e5c41
 runc:
  Version:          1.3.4
  GitCommit:        v1.3.4-0-gd6d73eb8
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
Docker info
Client:
 Version:    29.1.3
 Context:    default
 Debug Mode: false
 Plugins:
  ai: Docker AI Agent - Ask Gordon (Docker Inc.)
    Version:  v1.17.1
    Path:     /usr/local/lib/docker/cli-plugins/docker-ai
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.30.1-desktop.1
    Path:     /usr/local/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.40.3-desktop.1
    Path:     /usr/local/lib/docker/cli-plugins/docker-compose
  debug: Get a shell into any image or container (Docker Inc.)
    Version:  0.0.45
    Path:     /usr/local/lib/docker/cli-plugins/docker-debug
  desktop: Docker Desktop commands (Docker Inc.)
    Version:  v0.2.0
    Path:     /usr/local/lib/docker/cli-plugins/docker-desktop
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.31
    Path:     /usr/local/lib/docker/cli-plugins/docker-extension
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v1.4.0
    Path:     /usr/local/lib/docker/cli-plugins/docker-init
  mcp: Docker MCP Plugin (Docker Inc.)
    Version:  v0.34.0
    Path:     /usr/local/lib/docker/cli-plugins/docker-mcp
  model: Docker Model Runner (Docker Inc.)
    Version:  v1.0.2
    Path:     /usr/local/lib/docker/cli-plugins/docker-model
  offload: Docker Offload (Docker Inc.)
    Version:  v0.5.33
    Path:     /usr/local/lib/docker/cli-plugins/docker-offload
  pass: Docker Pass Secrets Manager Plugin (beta) (Docker Inc.)
    Version:  v0.0.21
    Path:     /usr/local/lib/docker/cli-plugins/docker-pass
  sandbox: Docker Sandbox (Docker Inc.)
    Version:  v0.6.0
    Path:     /usr/local/lib/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:     /usr/local/lib/docker/cli-plugins/docker-sbom
  scout: Docker Scout (Docker Inc.)
    Version:  v1.18.3
    Path:     /usr/local/lib/docker/cli-plugins/docker-scout

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 15
 Server Version: 29.1.3
 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: 1
 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
 Discovered Devices:
  cdi: docker.com/gpu=webgpu
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 nvidia runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 1c4457e00facac03ce1d75f7b6777a7a851e5c41
 runc version: v1.3.4-0-gd6d73eb8
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 5.15.167.4-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 15.62GiB
 Name: docker-desktop
 ID: 76035ee6-59aa-45c7-8e62-d418a9135207
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Labels:
  com.docker.desktop.address=unix:///var/run/docker-cli.sock
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  ::1/128
  127.0.0.0/8
 Registry Mirrors:
  https://dockerhub.timeweb.cloud/
 Live Restore Enabled: false
 Firewall Backend: iptables

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: Support for cgroup v1 is deprecated and planned to be removed by no later than May 2029 (https://github.com/moby/moby/issues/51111)
What happened?

basic clickhouse ping test doesnt work

It should do OK cause container, err := clickhouseTestContainer.Run with wait strategy returned nil error

Relevant log output
[user@10:28:11] ~/src/benchmarks
$ cat clickhouse_test.go && go test -v ./...
package main_test

import (
        "context"
        "io"
        "testing"

        "github.com/ClickHouse/clickhouse-go/v2"
        "github.com/testcontainers/testcontainers-go"
        testcontainersLog "github.com/testcontainers/testcontainers-go/log"
        clickhouseTestContainer "github.com/testcontainers/testcontainers-go/modules/clickhouse"
        "github.com/testcontainers/testcontainers-go/wait"
)

func TestClickhouse(t *testing.T) {
        testcontainersLog.SetDefault(testcontainersLog.NewNoopLogger())

        container, err := clickhouseTestContainer.Run(
                t.Context(),
                "clickhouse/clickhouse-server:latest",
                testcontainers.WithWaitStrategy(wait.ForListeningPort("9000/tcp")),
        )
        defer func() {
                if err := testcontainers.TerminateContainer(container); err != nil {
                    t.Fatal(err)
                }
        }()

        connString, err := container.ConnectionString(t.Context())
        if err != nil {
                t.Fatal(err)
        }

        config, err := clickhouse.ParseDSN(connString)
        if err != nil {
                t.Fatal(err)
        }

        conn, err := clickhouse.Open(config)
        if err != nil {
                t.Fatal(err)
        }

        defer conn.Close()
        defer func() {
                _, output, err := container.Exec(context.WithoutCancel(t.Context()), []string{"cat", "/var/log/clickhouse-server/clickhouse-server.err.log"})
                if err != nil {
                        t.Log(err)
                }

                _, err = io.Copy(t.Output(), output)
                if err != nil {
                        t.Log(err)
                }
        }()

        err = conn.Ping(t.Context())
        if err != nil {
                t.Fatal(err.Error())
        }
}
=== RUN   TestClickhouse
    clickhouse_test.go:59: handshake: failed to read packet from 127.0.0.1:32856 (conn_id=1, auth_db=clickhouse): read: read tcp 127.0.0.1:46917->127.0.0.1:32856: read: connection reset by peer
    �2026.09.03 07:28:34.325294 [ 126 ] {} <Warning> Application: Listen [0.0.0.0]:9009 failed: Poco::Exception. Code: 1000, e.code() = 98, Net Exception: Address already in use: 0.0.0.0:9009 (version 26.6.1.1193 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
    2026.09.03 07:28:34.329373 [ 126 ] {} <Warning> Access(local_directory): File /var/lib/clickhouse/access/users.list doesn't exist
    2026.09.03 07:28:34.329413 [ 126 ] {} <Warning> Access(local_directory): Recovering lists in directory /var/lib/clickhouse/access/
    2026.09.03 07:28:34.344262 [ 126 ] {} <Warning> Context: Linux transparent hugepages are set to "always". Check /sys/kernel/mm/transparent_hugepage/enabled
    2026.09.03 07:28:34.344648 [ 126 ] {} <Warning> Context: Delay accounting is not enabled, OSIOWaitMicroseconds will not be gathered. You can enable it using `sudo sh -c 'echo 1 > /proc/sys/kernel/task_delayacct'` or by using sysctl.
--- FAIL: TestClickhouse (13.47s)
FAIL
FAIL    benchmarks      13.475s
FAIL
Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied clickhouse_test.go reproduction and run go test -v ./... using clickhouseTestContainer.Run with wait.ForListeningPort("9000/tcp"). Inspect the ClickHouse module's startup and wait behavior against the logged handshake reset and port 9009 warning. Done means the basic container test reaches conn.Ping successfully or reports a clear, actionable startup failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
clickhouse, docker, go
Domain
databases, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.