Container with AspNet Core Web API runs on Docker but not on AKS Kubernetes Container with AspNet Core Web API runs on Docker but not on AKS Kubernetes kubernetes kubernetes

Container with AspNet Core Web API runs on Docker but not on AKS Kubernetes


That Dockerfile looks funny. It doesn't do anything. WORKDIR just "sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile" (from docs.docker.com). So you're setting the working directory twice, then nothing else. And the entrypoint would then point to a nonexistent .dll since you never copied it over. I think you want to delete the first WORKDIR command and add this after the remaining WORKDIR command:

COPY . ./

Even better, use a two stage build so it builds on docker, then copies the build to a runtime image that is published.

I don't know why docker run is working locally for you. Is it picking up an old image somehow? Based on your Dockerfile, it shouldn't run.