testcontainers / testcontainers/testcontainers-python

Clickhouse container exposing ports setup is strange

Open
#257 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

✅ close on merge 📦 package: clickhouse
Dominant language
Python
Stars
2.3k
Forks
386
Avg merge
4h 40m
Merged PRs (30d)
1

Description

When we use Clickhouse, we can use 2 kind of ports: 9000 and 8123.
Also different awesome libs work

  • with just 9000
  • with just 8123
  • with both 8123 and 9000 ports

Problem in that: i can use 8123 port or 9000, but can't proper expose it (for example outside port must be 66612) because exposing port seted auto and than no overrided by with_bind_ports(). Also it can be needed to expose 1823 and 9000 together.

ch_container = ClickHouseContainer(image='clickhouse/clickhouse-server:22.6.4', port=8123)
ch_container.with_bind_ports(8123, 66612)
db = ch_container.start() <- started and expose 8123 port to random port 69112 (not 66612)
print(ch.get_connection_url()) <- gives url with port 69112 (not 66612)

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 by tracing ClickHouseContainer port setup and the with_bind_ports() behavior described in the issue. Verify how explicit bindings for port 8123, port 9000, or both affect the started container and get_connection_url(); done means requested host ports are honored and the URL reports the correct mapped port.

Written by the indexing model from the issue text.

Assessment

Tech stack
clickhouse, docker, python
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.