DEV Community

Siri Varma Vegiraju
Siri Varma Vegiraju

Posted on

Using Dapr Cli

Purpose and Core Functions

The Dapr CLI is the main tool for managing Dapr (Distributed Application Runtime) applications. You can use it to:

  • Run applications with a Dapr sidecar
  • Review sidecar logs
  • List running services
  • Run the Dapr dashboard

The CLI works with both self-hosted and Kubernetes environments.

Installation

Linux/macOS:

# Latest version
curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | /bin/bash

# Specific version (e.g., 1.15.1)
curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh | /bin/bash -s 1.15.1
Enter fullscreen mode Exit fullscreen mode

Windows:

# PowerShell installation
powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"

# Or via winget
winget install Dapr.CLI
Enter fullscreen mode Exit fullscreen mode

macOS (Homebrew):

brew install dapr/tap/dapr-cli
Enter fullscreen mode Exit fullscreen mode

Key Commands

Once installed, the main commands available include:

  • dapr init - Install Dapr runtime on your hosting platform
  • dapr run - Run your application with Dapr sidecar
  • dapr list - List all running Dapr instances
  • dapr dashboard - Start the Dapr dashboard
  • dapr invoke - Invoke methods on Dapr applications
  • dapr publish - Publish pub-sub events
  • dapr logs - Get sidecar logs for applications
  • dapr status - Show health status of Dapr services
  • dapr stop - Stop Dapr instances and their apps
  • dapr components - List all Dapr components
  • dapr configurations - List all Dapr configurations
  • dapr version - Print runtime and CLI version

Verification

To verify installation, run:

dapr -h
Enter fullscreen mode Exit fullscreen mode

source: https://docs.dapr.io/getting-started/install-dapr-cli/

Top comments (0)