Skip to content
Explore

Try CrateDB Live

Run CrateDB on Docker

If you prefer to run everything locally, Docker provides a quick setup with minimal dependencies.

1. Prerequisites

Ensure you have the following installed:

  • Docker (latest version recommended)
  • At least 4 GB RAM available for the container
  • Open ports: 4200 (HTTP) and 5432 (PostgreSQL wire protocol)

Run the following command:

2. Fetching the latest CrateDB image and running

docker run -d \
      --name=cratedb \
      -p 4200:4200 \
      -p 5432:5432 \
      crate/crate:latest \
      crate \
      -Cdiscovery.type=single-node

This command:

  • starts a single-node CrateDB cluster
  • exposes:
    • 4200 as the HTTP endpoint (Admin UI + REST)
    • 5432 as the PostgreSQL-compatible endpoint (for SQL clients)
  • uses discovery.type=single-node to avoid cluster configuration complexity

3. Verify the instance is running

Open your browser and navigate to:

http://localhost:4200

You should see the CrateDB Admin UI.

Alternatively, test via curl:

curl http://localhost:4200/

4. Connect using SQL

You can connect using any PostgreSQL-compatible client.

Option 1: Using psql

psql -h localhost -p 5432 -U crate

No password is required by default.

Option 2: Using the Admin UI

  • Go to Console in the web UI
  • Run a test query:
SELECT 1;

5. Persist data (optional)

To avoid losing data when the container is removed:

docker run -d \
      --name=cratedb \
      -p 4200:4200 \
      -p 5432:5432 \
      -v cratedb-data:/data \
      crate/crate:latest \
      crate \ 
      -Cdiscovery.type=single-node \
      -Cpath.data=/data