4.2 KiB
| type | title | linkTitle | weight | description | aliases | |
|---|---|---|---|---|---|---|
| docs | How-To: Install Dapr into your local environment | Init Dapr locally | 20 | Install Dapr in your local environment for testing and self-hosting |
|
Prerequisites
- Install [Dapr CLI]({{< ref install-dapr-cli.md >}})
- Install Docker Desktop
- Windows users ensure that
Docker Desktop For Windowsuses Linux containers. - (alternately) Install Dapr without Docker using [Dapr slim init]({{< ref self-hosted-no-docker.md >}})
- Windows users ensure that
Initialize Dapr using the CLI
This step installs the latest Dapr Docker containers and setup a developer environment to help you get started easily with Dapr.
- In Linux/MacOS Dapr is initialized with default components and files in
$HOME/.dapr. - For Windows Dapr is initialized to
%USERPROFILE%\.dapr\
{{% alert title="Note" color="warning" %}} This command downloads and installs Dapr runtime v0.11. To install v1.0-rc1, the release candidates for the upcoming v1.0 release, please visit the v1.0-rc1 docs. {{% /alert %}}
-
Ensure you are in an elevated terminal:
{{< tabs "Linux/MacOS" "Windows">}}
{{% codetab %}} If you run your docker commands with sudo or the install path is
/usr/local/bin(default install path), you need to usesudo{{% /codetab %}}{{% codetab %}} Make sure that you run the command prompt terminal in administrator mode (right click, run as administrator) {{% /codetab %}}
{{< /tabs >}}
-
Run
dapr init:You can install or upgrade to a specific version of the Dapr runtime using
dapr init --runtime-version. You can find the list of versions in Dapr Release$ dapr init ⌛ Making the jump to hyperspace... Downloading binaries and setting up components ✅ Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started -
Verify Dapr version with
dapr --version:$ dapr --version CLI version: 0.11 Runtime version: 0.11 -
Verify Dapr containers are running with
docker ps:Make sure the
daprio/dapr,openzipkin/zipkin, andrediscontainer images are all running:$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0dda6684dc2e openzipkin/zipkin "/busybox/sh run.sh" 2 minutes ago Up 2 minutes 9410/tcp, 0.0.0.0:9411->9411/tcp dapr_zipkin 9bf6ef339f50 redis "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:6379->6379/tcp dapr_redis 8d993e514150 daprio/dapr "./placement" 2 minutes ago Up 2 minutes 0.0.0.0:6050->50005/tcp dapr_placement -
Verify Dapr directory has been initialized
{{< tabs "Linux/MacOS" "Windows">}}
{{% codetab %}} Run
ls $HOME/.dapr:$ ls $HOME/.dapr bin components config.yaml{{% /codetab %}}
{{% codetab %}} Open
%USERPROFILE%\.dapr\in file explorer{{< /tabs >}}
Uninstall Dapr in self-hosted mode
This cli command removes the placement Dapr container:
$ dapr uninstall
{{% alert title="Warning" color="warning" %}}
This command won't remove the Redis or Zipkin containers by default, just in case you were using them for other purposes. To remove Redis, Zipkin, Actor Placement container, as well as the default Dapr directory located at $HOME/.dapr or %USERPROFILE%\.dapr\, run:
$ dapr uninstall --all
{{% /alert %}}
{{% alert title="Note" color="primary" %}}
For Linux/MacOS users, if you run your docker cmds with sudo or the install path is /usr/local/bin(default install path), you need to use sudo dapr uninstall to remove dapr binaries and/or the containers.
{{% /alert %}}
Next steps
- [Setup a state store and pub/sub message broker]({{< ref configure-state-pubsub.md >}})
