To try CockroachDB Cloud instead of running CockroachDB yourself, refer to the Cloud Quickstart.
CockroachDB executable for Windows is experimental and not suitable for production deployments. Windows 8 or higher is required.
Use one of the options below to install CockroachDB. To upgrade an existing cluster, refer to Upgrade to v22.2.
Download the executable
You can download and install CockroachDB for Windows in two ways. Either:
Recommended: Visit Releases to download CockroachDB. The archive contains the
cockroach.exe
binary. Extract the archive and optionally copy thecockroach.exe
binary into yourPATH
so you can execute cockroach commands from any shell. Releases are rolled out gradually, so the latest version may not yet be downloadable.Instead of downloading the binary directly, you can use PowerShell to download and install CockroachDB:
- Visit Releases and make a note of the full version of CockroachDB to install, such as v22.2.19. Releases are rolled out gradually, so the latest version may not yet be downloadable.
Save the following PowerShell script and replace the following:
{ VERSION }
: the full version of CockroachDB to download, such asv22.2.19
. Replace this value in both theInvoke-WebRequest
statement and theCopy-Item
statement.{ INSTALL_DIRECTORY }
: the local file path where thecockroachdb.exe
executable will be installed. Replace the value in both theDestination
argument and the$Env:PATH
statement, which adds the destination directory to yourPATH
.$ErrorActionPreference = "Stop"; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;$ProgressPreference = 'SilentlyContinue'; $null = New-Item -Type Directory -Force $env:appdata/cockroach; Invoke-WebRequest -Uri https://binaries.cockroachdb.com/cockroach-{ VERSION }.windows-6.2-amd64.zip -OutFile cockroach.zip; Expand-Archive -Force -Path cockroach.zip; Copy-Item -Force "cockroach/cockroach-{ VERSION }.windows-6.2-amd64/cockroach.exe" -Destination $env:{ INSTALL_DIRECTORY };$Env:PATH += ";$env:{ INSTALL_DIRECTORY }"
Run the PowerShell script. To run a PowerShell script from a file, use syntax like:
powershell.exe -Command "{path_to_script}"
Check that the installation succeeded and that you can run
cockroach
commands:cockroach version
Use Kubernetes
To orchestrate CockroachDB locally using Kubernetes, either with configuration files or the Helm package manager, refer to Orchestrate a local cluster with Kubernetes.
Use Docker
This section shows how to install CockroachDB on a Windows host using Docker. On a Linux or Windows Docker host, the image creates a Linux container.
Running a stateful application like CockroachDB in Docker is more complex and error-prone than most uses of Docker. Unless you are very experienced with Docker, we recommend starting with a different installation and deployment method.
Docker images are multi-platform images that contain binaries for both Intel and ARM. Multi-platform images do not take up additional space on your Docker host.
Intel binaries can run on ARM systems, but with a significant reduction in performance.
Install Docker for Windows.
Tip:Docker for Windows requires 64-bit Windows 10 Pro and Microsoft Hyper-V. Refer to the official documentation for more details. If your system does not satisfy the stated requirements, you can try using Docker Toolbox.
In PowerShell, confirm that Docker is running in the background:
docker version
If you see an error, verify your Docker for Windows installation, then try again.
Enable synchronized drive sharing so you can mount local directories as data volumes to persist node data after containers are stopped or deleted.
Pull the image for CockroachDB from Docker Hub. Releases are rolled out gradually, so the latest version may not yet be available. Using the
latest
tag is not recommended; to pull the latest release within a major version, use a tag likelatest-v22.2
. The following command always pulls thev22.2.19
image.docker pull cockroachdb/cockroach:v22.2.19
Keep up-to-date with CockroachDB releases and best practices:
What's next?
- If you're just getting started with CockroachDB:
- Start a cluster locally and talk to it via the built-in SQL client
- Learn more about CockroachDB SQL
- Build a simple application with CockroachDB using PostgreSQL-compatible client drivers and ORMs
- Explore core CockroachDB features like automatic replication, rebalancing, and fault tolerance
- If you're ready to run CockroachDB in production: