dapr init
Now that you’ve installed the Dapr CLI, use the CLI to initialize Dapr on your local machine.
Dapr runs as a sidecar alongside your application. In self-hosted mode, this means it is a process on your local machine. By initializing Dapr, you:
Dapr initialization includes:
The recommended development environment requires Docker. While you can initialize Dapr without a dependency on Docker, the next steps in this guide assume the recommended Docker development environment.
You can also install Podman in place of Docker. Read more about initializing Dapr using Podman.
You will need to use sudo
for this quickstart if:
sudo
, or/usr/local/bin
(default install path).Run Windows Terminal or command prompt as administrator.
Install the latest Dapr runtime binaries:
dapr init
If you run your Docker cmds with sudo, you need to use:
sudo dapr init
If you are installing on Mac OS Silicon with Docker, you may need to perform the following workaround to enable dapr init
to talk to Docker without using Kubernetes.
Install the latest Dapr runtime binaries:
dapr init
Expected output:
dapr --version
Output:
CLI version: 1.15.1
Runtime version: 1.15.5
As mentioned earlier, the dapr init
command launches several containers that will help you get started with Dapr. Verify you have container instances with daprio/dapr
, openzipkin/zipkin
, and redis
images running:
docker ps
Output:
On dapr init
, the CLI also creates a default components folder that contains several YAML files with definitions for a state store, Pub/sub, and Zipkin. The Dapr sidecar will read these components and use:
Verify by opening your components directory:
%UserProfile%\.dapr
~/.dapr
ls $HOME/.dapr
Output:
bin components config.yaml
You can verify using either PowerShell or command line. If using PowerShell, run:
explorer "$env:USERPROFILE\.dapr"
If using command line, run:
explorer "%USERPROFILE%\.dapr"
Result:
To install the CLI without any default configuration files or Docker containers, use the --slim
flag. Learn more about the init
command and its flags.
dapr init --slim