MirrorNest
← All guides

CockroachDB

A distributed SQL database that speaks the PostgreSQL wire protocol — built from the ground up for automatic sharding, replication, and surviving node failures without manual failover work.

Target: Any Docker hostdistributed-SQLPostgreSQL-compatibleDockerOfficial homepage ↗Official docs ↗
This guide is synthesized from CockroachDB's own official documentation, linked above — always cross-check exact package/version names there before running these commands on a production server, since distro and project versions move over time.
  1. 1Run a single-node instance

    A single node is enough to try CockroachDB locally; production deployments run 3+ nodes for real replication and fault tolerance.

    docker run -d \ --name cockroachdb \ -p 26257:26257 -p 8088:8080 \ -v ./cockroach/data:/cockroach/cockroach-data \ --restart unless-stopped \ cockroachdb/cockroach:latest start-single-node --insecure
  2. 2Open the built-in admin UI

    http://your-server-ip:8088
  3. 3Connect with any PostgreSQL client

    Because CockroachDB implements the PostgreSQL wire protocol, the standard `psql` client and most PostgreSQL drivers/ORMs work against it with no special adapter.

    docker exec -it cockroachdb ./cockroach sql --insecure

    The --insecure flag is fine for local testing only -- a real deployment should generate TLS certificates and set up proper authentication, covered in CockroachDB's production-deployment docs.