dapr / dapr/cli

Dapr has incorrect component configurations when network flag is specified on init

Open
#545 8 comments 1 reaction 0 assignees View on GitHub
discussion kind/bug P2 pinned
Dominant language
Go
Stars
353
Forks
221
Avg merge
3d 8h
Merged PRs (30d)
2

Description

## Expected Behavior

dapr quickstarts work as expected

## Actual Behavior

Dapr has incorrect component configurations when network flag is specified on init

It has configurations either as
localhost:6739 (all versions prior to 1.0.0-rc2) or dapr_redis:6739 (proposed fix for `#418` issue after 1.0.0-rc2).

When --network argument is specified on init, no ports are exposed https://github.com/dapr/cli/blob/v0.8.0/pkg/standalone/standalone.go#L215

Since no ports are exposed, dapr sidecar for dapr applications cannot connect to the right containers be it redis, zipkin or placement.
This is a scenario where a custom network is specified, no ports are exposed locally.

Without custom docker network specified:
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a93725b076f8 daprio/dapr "./placement" 42 minutes ago Up 42 minutes 0.0.0.0:50005->50005/tcp dapr_placement
96dbb8b93f5e openzipkin/zipkin "start-zipkin" 42 minutes ago Up 42 minutes (healthy) 9410/tcp, 0.0.0.0:9411->9411/tcp dapr_zipkin
e3a40ccbd225 redis "docker-entrypoint.s…" 42 minutes ago Up 42 minutes 0.0.0.0:6379->6379/tcp dapr_redis
```
Note: 0.0.0.0:50005->50005/tcp for placement and similar ones for others.
With docker network:

```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
592dcf2bc8dd daprio/dapr "./placement" 21 seconds ago Up 20 seconds dapr_placement_mynet
305274bd5a5e redis "docker-entrypoint.s…" 32 seconds ago Up 31 seconds 6379/tcp dapr_redis_mynet
0682ffd22c12 openzipkin/zipkin "start-zipkin" 32 seconds ago Up 31 seconds (healthy) 9410-9411/tcp dapr_zipkin_mynet
```
Note: no port forwarding.
## Steps to Reproduce the Problem

create a custom docker network
run `dapr init --network mynet`
check the configuration files.

This issue does not affect dev-containers since the app itself is running inside a container in the same docker network and DNS resolution is provided by docker in that scenario.
```
https://github.com/microsoft/vscode-dev-containers/blob/master/containers/dapr-dotnetcore-3.1/.devcontainer/docker-compose.yml
```

## Release Note

RELEASE NOTE:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.