Install CockroachDB on Windows

On this page Carat arrow pointing down
Tip:

To deploy a free CockroachDB Cloud cluster instead of running CockroachDB yourself, see the Quickstart.

Warning:

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 the cockroach.exe binary into your PATH 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:

    1. 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.
    2. Save the following PowerShell script and replace the following:

      • { VERSION }: the full version of CockroachDB to download, such as v22.2.19. Replace this value in both the Invoke-WebRequest statement and the Copy-Item statement.
      • { INSTALL_DIRECTORY }: the local file path where the cockroachdb.exe executable will be installed. Replace the value in both the Destination argument and the $Env:PATH statement, which adds the destination directory to your PATH.

        icon/buttons/copy
        $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 }"
        
    3. Run the PowerShell script. To run a PowerShell script from a file, use syntax like:

      icon/buttons/copy
      powershell.exe -Command "{path_to_script}"
      
    4. Check that the installation succeeded and that you can run cockroach commands:

      icon/buttons/copy

      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.

Warning:

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.

  1. 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.

  2. In PowerShell, confirm that Docker is running in the background:

    icon/buttons/copy
    docker version
    

    If you see an error, verify your Docker for Windows installation, then try again.

  3. Enable synchronized drive sharing so you can mount local directories as data volumes to persist node data after containers are stopped or deleted.

  4. 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 like latest-v22.2. The following command always pulls the v22.2.19 image.

    icon/buttons/copy
    docker pull cockroachdb/cockroach:v22.2.19
    

Keep up-to-date with CockroachDB releases and best practices:

What's next?

Note:
By default, each node of a CockroachDB cluster periodically shares anonymous usage details with Cockroach Labs. For an explanation of the details that get shared and how to opt-out of reporting, see Diagnostics Reporting.

Yes No
On this page

Yes No