<p>Hello I want to deploy in docker: .net, kestrel and nginx.
I have a project assembly without .csproj (it is possible or need .csproj ?)
But when I try to deploy my .net project in Docker I had status Exitet.</p>
<hr />
<pre><code>Dockerfile 

FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env

WORKDIR /app

COPY . .


FROM mcr.microsoft.com/dotnet/core/aspnet:2.2

WORKDIR /app

COPY . .

EXPOSE 80

ENTRYPOINT [&quot;bash&quot;]

CMD [&quot;build1&quot;, &quot;WebApplication4.dll&quot;]
</code></pre>
<hr />
<p>My project files</p>
<pre><code>appsettings.Development.json

appsettings.json

Dockerfile

WebApplication4

WebApplication4.deps.json

WebApplication4.dll

WebApplication4.pdb

WebApplication4.runtimeconfig.json

WebApplication4.Views.dll

WebApplication4.Views.pdb

web.config

wwwroot
</code></pre>
<hr />
<p><code>docker ps --all</code> output:</p>
<pre><code>CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                       PORTS               NAMES

0f1880a89999        build1              &quot;bash build1 WebAppl…&quot;   4 seconds ago       Exited (127) 3 seconds ago                       sleepy_bardeen
</code></pre>
<hr />
<p>If you have a interes how to resolve. Answer.</p>
<pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS final

WORKDIR /app

EXPOSE 80

COPY . .

ENTRYPOINT [&quot;dotnet&quot;, &quot;WebApplication4.dll&quot;]
</code></pre>
<p>Right now. I try to find decision how to add nginx and kestrel ?</p>

noute
<p>Microsoft suggests to use NGINX as a reverse proxy to .NET Core applications. You need to build the image and install NGINX in your dockerfile. </p>

<p>For example:</p>

<pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS final

# Nginx
RUN apt update &amp;&amp; \
    apt install -y --no-install-recommends nginx &amp;&amp; \
    rm -rf /var/lib/apt/lists/* &amp;&amp; \
    apt clean &amp;&amp; \
    rm /etc/nginx/nginx.conf
COPY MyProject/docker/nginx.conf /etc/nginx/nginx.conf

WORKDIR /app
ENV ASPNETCORE_URLS http://+:4000
EXPOSE 4000 80
</code></pre>

<p>As you can see I'm installing NGINX in my dockerfile and exposing <code>4000</code> and <code>80</code> port numbers. In the <code>nginx.conf</code> file NGINX listens for port <code>80</code> and pass requests to <code>4000</code> which is the port my .NET Core application listens.</p>

<p>You can find further information in this article: <a href="https://piotrgankiewicz.com/2017/06/12/asp-net-core-deployment-using-docker-nginx-and-ubuntu-server/" rel="nofollow noreferrer">https://piotrgankiewicz.com/2017/06/12/asp-net-core-deployment-using-docker-nginx-and-ubuntu-server/</a></p>
