The documentation you are viewing is for Dapr v1.2 which is an older version of Dapr. For up-to-date documentation, see the latest version.

安装 Dapr CLI

Dapr CLI 是您用于各种 Dapr 相关任务的主要工具。 您可以使用它来运行一个带有Dapr sidecar的应用程序, 以及查看sidecar日志、列出运行中的服务、运行 Dapr 仪表板。 The Dapr CLI works with both self-hosted and Kubernetes environments.

开始下载并安装 Dapr CLI:

此命令将安装最新的 Linux Dapr CLI 到 /usr/local/bin

wget -q -O - | /bin/bash

This Command Prompt command installs the latest windows Dapr cli to C:\dapr and adds this directory to User PATH environment variable.

powershell -Command "iwr -useb | iex"

This command installs the latest darwin Dapr CLI to /usr/local/bin:

curl -fsSL | /bin/bash

Or you can install via Homebrew:

brew install dapr/tap/dapr-cli

Each release of Dapr CLI includes various OSes and architectures. These binary versions can be manually downloaded and installed.

  1. 从最新的 Dapr Releases中下载所需的 Dapr CLI
  2. 解压它(例如,dapr_linux_amd64.tar.gz,
  3. 将其移动到你想要的位置。
    • For Linux/MacOS - /usr/local/bin
    • 对于Windows,创建一个目录并将其添加到系统PATH。 例如,通过编辑系统环境变量,创建一个名为 C:\dapr 的目录,并将此目录添加到您的用户PATH。

Step 2: Verify the installation

You can verify the CLI is installed by restarting your terminal/command prompt and running the following:


The output should look like this:

    ____/ /___ _____  _____
   / __  / __ '/ __ \/ ___/
  / /_/ / /_/ / /_/ / /
  \__,_/\__,_/ .___/_/

Distributed Application Runtime

  dapr [command]

Available Commands:
  completion     Generates shell completion scripts
  components     List all Dapr components. Supported platforms: Kubernetes
  configurations List all Dapr configurations. Supported platforms: Kubernetes
  dashboard      Start Dapr dashboard. Supported platforms: Kubernetes and self-hosted
  help           Help about any command
  init           Install Dapr on supported hosting platforms. Supported platforms: Kubernetes and self-hosted
  invoke         Invoke a method on a given Dapr application. Supported platforms: Self-hosted
  list           List all Dapr instances. Supported platforms: Kubernetes and self-hosted
  logs           Get Dapr sidecar logs for an application. Supported platforms: Kubernetes
  mtls           Check if mTLS is enabled. Supported platforms: Kubernetes
  publish        Publish a pub-sub event. Supported platforms: Self-hosted
  run            Run Dapr and (optionally) your application side by side. Supported platforms: Self-hosted
  status         Show the health status of Dapr services. Supported platforms: Kubernetes
  stop           Stop Dapr instances and their associated apps. . Supported platforms: Self-hosted
  uninstall      Uninstall Dapr runtime. Supported platforms: Kubernetes and self-hosted
  upgrade        Upgrades a Dapr control plane installation in a cluster. Supported platforms: Kubernetes

  -h, --help      help for dapr
  -v, --version   version for dapr

Use "dapr [command] --help" for more information about a command.
Next step: Initialize Dapr >>