Skip to content

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

Open
@mukundansundar

Description

@mukundansundar

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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions