Local Postgres container names collide across projects
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start in crates/clickhousectl/src/local/docker.rs with pg_container_name, then trace how ensure_name_free and inspect, stop, and remove identify containers and use project labels. Check the corresponding tests and existing ClickHouse server naming for project-scoped behavior. Done means names are project-specific and existing containers with old names can still be managed by their project.
Written by the indexing model from the issue text.
Description
Problem
Local Postgres instances are project-scoped. Data lives under <project>/.clickhouse/servers/<name>-pg<major>/, and containers carry a project label. But the Docker container name has no project component:
// crates/clickhousectl/src/local/docker.rs
pub fn pg_container_name(user_name: &str, major: &str) -> String {
format!("clickhousectl-pg-{}-{}", user_name, major)
}
ensure_name_free returns ContainerNameConflict when an existing container with that name has a different project label. So two projects can't both run local postgres start with the default name and the same major version: the second one fails.
This hits the common parallel-agent setup hardest. Several coding agents, each in its own git worktree of one repo, each run local postgres start and expect isolated instances.
Expected
Instance names are unique per project, as they are for ClickHouse servers, so the container name should be too. For example, clickhousectl-pg-<project hash>-<name>-<major>, where the hash is a short stable hash of the canonical project root.
Notes
- Migration: existing containers keep their old names until they are next recreated. Inspect, stop and remove should accept both forms and match on the project label.
- Docker limits container names to
[a-zA-Z0-9][a-zA-Z0-9_.-]. Keep the hash short so the name stays readable indocker ps. - Related: a cross-project port race is possible. Port probing is serialised only by the per-project metadata lock, so two projects starting at the same moment could pick the same port. That is inferred from the code, not reproduced.
- Found while researching a global registry for local servers.
🤖 Generated with Claude Code
- Dominant language
- Rust
- Stars
- 80
- Forks
- 9
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 47
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ClickHouse/clickhousectl
-
cargo audit red on main: RUSTSEC-2026-0387 (crypto-bigint 0.5.5 via aws-config credentials-login)Possibly taken @sdairs claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ClickHouse/clickhousectl#1183 ·
Maintainers usually reply within 1 day
-
Reject empty positional IDs as usage errors instead of sending them to the APIPossibly taken @sdairs claimed this today. Openbug cloud
ClickHouse/clickhousectl#1246 · 1 assignee ·
Maintainers usually reply within 1 day
-
AWS backup bucket create cannot succeed in orgs without the external-ID feature (iamRoleExternalId required by the library, rejected by the server)Possibly taken @sdairs claimed this today. Openbug cloud
ClickHouse/clickhousectl#1245 · 1 assignee ·
Maintainers usually reply within 1 day
-
Cloud file-reading flags report bare 'No such file or directory' without the flag or pathPossibly taken @sdairs claimed this today. Openbug cloud
ClickHouse/clickhousectl#1244 · 1 assignee ·
Maintainers usually reply within 1 day
-
clickpipe create kafka/kinesis/pubsub: require --column, as object-storage doesPossibly taken @sdairs claimed this today. Openbug cloud
ClickHouse/clickhousectl#1243 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in ClickHouse/clickhousectl
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
near/near-sdk-rs#1676 ·
Maintainers usually reply within 2 days
-
auto:producer auto:security
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
fritzprix/libr-agent#2595 ·
Maintainers usually reply within 1 day
-
area:fs type:fix
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Tripstack-Corp/spyc#1002 ·
Maintainers usually reply within 1 day
-
github_actions security
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
dekobon/big-code-analysis#1815 ·
Maintainers usually reply within 1 day
-
[Detail Bug] Request logs can be forged via control characters in fetch object keys (log injection)Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
s2-streamstore/cachey#211 ·
Maintainers usually reply within 1 day