dapr / java-sdk

Dapr SDK for Java
Apache License 2.0
262 stars 207 forks source link

Unable to deploy dapr application using Dockerfile #565

Open naichowdhury opened 3 years ago

naichowdhury commented 3 years ago

Expected Behavior

Successfully able to deploy and run the container

Actual Behavior

Container is unable to start and generating the below logs:

Events: Type Reason Age From Message


Normal Scheduled 29s default-scheduler Successfully assigned dapr-system/currency-exchange-6c4fdcbb88-wh9mp to gke-k8s-poc-istio-default-pool-35bfdde6-m30w Normal Pulled 28s kubelet, gke-k8s-poc-istio-default-pool-35bfdde6-m30w Successfully pulled image "naichowdhury/daprcurrencyexchange:0.0.2" in 508.1759ms Normal Pulled 27s kubelet, gke-k8s-poc-istio-default-pool-35bfdde6-m30w Successfully pulled image "naichowdhury/daprcurrencyexchange:0.0.2" in 516.241312ms Normal Pulling 12s (x3 over 28s) kubelet, gke-k8s-poc-istio-default-pool-35bfdde6-m30w Pulling image "naichowdhury/daprcurrencyexchange:0.0.2" Normal Created 12s (x3 over 28s) kubelet, gke-k8s-poc-istio-default-pool-35bfdde6-m30w Created container currency-exchange Normal Pulled 12s kubelet, gke-k8s-poc-istio-default-pool-35bfdde6-m30w Successfully pulled image "naichowdhury/daprcurrencyexchange:0.0.2" in 509.781022ms Warning Failed 11s (x3 over 28s) kubelet, gke-k8s-poc-istio-default-pool-35bfdde6-m30w Error: failed to start container "currency-exchange": Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"dapr\": executable file not found in $PATH": unknown Warning BackOff 7s (x3 over 26s) kubelet, gke-k8s-poc-istio-default-pool-35bfdde6-m30w Back-off restarting failed container

Steps to Reproduce the Problem

Using the attached docker file and deployment file to deploy my application in my GKE cluster where already dapr is installed:

Dockerfile.txt deployment.txt

Note:

Have installed dapr in both the remote machine and my local machine (since am using the google cloud sdk shell to run the deployment files from my local)

rovangju commented 3 years ago

Your Dockerfile indicates you're using the openjdk image and expecting Dapr to be in it, which it isn't .

naichowdhury commented 3 years ago

Your Dockerfile indicates you're using the openjdk image and expecting Dapr to be in it, which it isn't .

-- i checked the dapr website it says for development installing dapr runtime through a docker file is okay but for production environment it is not suggested. So, can you kindly suggest which jdk image shall i use or if there is any way to use an image with the Dapr in it

rovangju commented 3 years ago

If you're running in Kubernetes you can install Dapr to the cluster to leverage it fully: https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-overview/

I personally use the helm chart.

If for some reason you want to run dapr within your docker image, you need to download + install it in your runtime environment (e.g.: run wget or curl, and extract it)

artursouza commented 3 years ago

Please, use K8s for running Dapr sidecar as a container. We do not recommend using sidecar built into the app's Docker image since it does not have the orchestration provided by Dapr's control plane in K8s (components, service discovery, mTLS, etc).