title: Docker with .NET core: How to run 2 apps (.Net Core Api and .Net React) on a docker (Docker for Windows (linux))?
body: <p>I have 2 projects(Diagnostique.FO and Diagnostique.BO) in my solution, i want to execute all my projects using Docker.</p>
  
  <ol>
  <li>Diagnostique.BO project is ASP.NET CORE API project (CORE 2.1).</li>
  <li>Diagnostique.FO Project is ASP.NET CORE React.js project (CORE 2.1).</li>
  </ol>
  
  <p>The 2 projects are independents, the project Diagnostique.FO calls functions from project Diagnostique.BO using HTTP services (Restfull).</p>
  
  <p>Here is my solution : <a href="https://github.com/draja23/Diagnostiques_Indep" rel="nofollow noreferrer">my solution with projects</a></p>
  
  <p>I create 2 Dockerfiles for 2 projects and 1 Docker-compose.yml file.
   :<a href="https://i.stack.imgur.com/AOfb4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AOfb4.png" alt="enter image description here"></a></p>
  
  <p><strong>Diagnostique.BO Dockerfile Contains :</strong></p>
  
  <pre><code>FROM microsoft/dotnet:2.1.2-aspnetcore-runtime-stretch-slim
  WORKDIR /app
  COPY bin/Release/netcoreapp2.1/publish /app/
  ENTRYPOINT ["dotnet", "Diagnostique.BO.dll"]
  </code></pre>
  
  <p><strong>Diagnostique.FO Dockerfile Contains :</strong></p>
  
  <pre><code>FROM microsoft/dotnet:2.1.2-aspnetcore-runtime-stretch-slim
  WORKDIR /app
  COPY bin/Release/netcoreapp2.1/publish /app/
  ENTRYPOINT ["dotnet", "Diagnostique.FO.dll"]
  </code></pre>
  
  <p><strong>Docker-compose.yml Contains :</strong></p>
  
  <pre><code>version: "3"
  services:
      front:
          build: Diagnostique.FO/.
          ports:
              - "8081:80"
      back:
          build: Diagnostique.BO/.
          ports:
              - "8082:44318"
          depends_on:
              - NDV1289
      NDV1289:
          image: "microsoft/mssql-server-linux"
          environment:
              SA_PASSWORD: "mYpASS@@"
              ACCEPT_EULA: "Y"
          ports:
              - "1433:1433"
  </code></pre>
  
  <p>When i execute <strong>docker-compose build</strong> using powershell :</p>
  
  <pre><code>Building front
  Step 1/4 : FROM microsoft/dotnet:2.1.2-aspnetcore-runtime-stretch-slim
  2.1.2-aspnetcore-runtime-stretch-slim: Pulling from microsoft/dotnet
  be8881be8156: Pull complete
  f854db899319: Pull complete
  4591fd524b8e: Pull complete
  65f224da8749: Pull complete
  Digest: sha256:01c2982ecf9aca0a5934c98e417e550afc7cd6bd1e4f7b87399626a7290c30d6
  Status: Downloaded newer image for microsoft/dotnet:2.1.2-aspnetcore-runtime-stretch-slim
   ---&gt; fcc3887985bb
  Step 2/4 : WORKDIR /app
   ---&gt; Running in e1bf155b3f2a
  Removing intermediate container e1bf155b3f2a
   ---&gt; 9e414dbff80d
  Step 3/4 : COPY bin/Release/netcoreapp2.1/publish /app/
   ---&gt; 6a645f992658
  Step 4/4 : ENTRYPOINT ["dotnet", "Diagnostique.FO.dll"]
   ---&gt; Running in f64ed2f6694b
  Removing intermediate container f64ed2f6694b
   ---&gt; 9edf8b23878d
  Successfully built 9edf8b23878d
  Successfully tagged diagnostiquesdeconnecte_front:latest
  NDV1289 uses an image, skipping
  Building back
  Step 1/4 : FROM microsoft/dotnet:2.1.2-aspnetcore-runtime-stretch-slim
   ---&gt; fcc3887985bb
  Step 2/4 : WORKDIR /app
   ---&gt; Using cache
   ---&gt; 9e414dbff80d
  Step 3/4 : COPY bin/Release/netcoreapp2.1/publish /app/
   ---&gt; d302f9908d38
  Step 4/4 : ENTRYPOINT ["dotnet", "Diagnostique.BO.dll"]
   ---&gt; Running in 3dea351ef605
  Removing intermediate container 3dea351ef605
   ---&gt; 584fb11936c3
  Successfully built 584fb11936c3
  Successfully tagged diagnostiquesdeconnecte_back:latest
  </code></pre>
  
  <p>And <strong>docker-compose up</strong></p>
  
  <pre><code>        Creating network "diagnostiquesdeconnecte_default" with the default driver
          Pulling NDV1289 (microsoft/mssql-server-linux:)...
          latest: Pulling from microsoft/mssql-server-linux
          f6fa9a861b90: Pull complete
          da7318603015: Pull complete
          6a8bd10c9278: Pull complete
          d5a40291440f: Pull complete
          bbdd8a83c0f1: Pull complete
          3a52205d40a6: Pull complete
          6192691706e8: Pull complete
          1a658a9035fb: Pull complete
          69238266c4f2: Pull complete
          37c1bf288fdc: Pull complete
          Digest: sha256:8231b746946d12a6a1d5e6c7bcb3d983e97ed1fe5ba3ad04e52305060aced166
          Status: Downloaded newer image for microsoft/mssql-server-linux:latest
          Creating diagnostiquesdeconnecte_NDV1289_1 ... done
          Creating diagnostiquesdeconnecte_front_1   ... done
          Creating diagnostiquesdeconnecte_back_1    ... done
          Attaching to diagnostiquesdeconnecte_NDV1289_1, diagnostiquesdeconnecte_front_1, diagnostiquesdeconnecte_back_1
          front_1    | warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
          front_1    |       No XML encryptor configured. Key {bb7aff1d-7d0e-4ee2-be65-b3c955e1c197} may be persisted to storage in unencrypted form.
          back_1     | warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
          back_1     |       No XML encryptor configured. Key {26b8016f-3f14-4747-a938-8053c447132a} may be persisted to storage in unencrypted form.
          front_1    | Hosting environment: Production
          front_1    | Content root path: /app
          front_1    | Now listening on: http://[::]:80
          front_1    | Application started. Press Ctrl+C to shut down.
          back_1     | Hosting environment: Production
          back_1     | Content root path: /app
          back_1     | Now listening on: http://[::]:80
          back_1     | Application started. Press Ctrl+C to shut down.
          NDV1289_1  | 2018-08-02 10:26:27.50 Server      Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'.
          2018-08-02 10:26:27.55 Server      Did not find an existing master data file /var/opt/mssql/data/master.mdf, copying the missing default master and other system database files. If you have moved the database location, but not moved the database files, startup may fail. To repair: shutdown SQL Server, move the master database to configured location, and restart.
          2018-08-02 10:26:27.56 Server      Setup step is copying system data file 'C:\templatedata\mastlog.ldf' to '/var/opt/mssql/data/mastlog.ldf'.
          2018-08-02 10:26:27.56 Server      Setup step is copying system data file 'C:\templatedata\model.mdf' to '/var/opt/mssql/data/model.mdf'.
          2018-08-02 10:26:27.58 Server      Setup step is copying system data file 'C:\templatedata\modellog.ldf' to '/var/opt/mssql/data/modellog.ldf'.
          2018-08-02 10:26:27.59 Server      Setup step is copying system data file 'C:\templatedata\msdbdata.mdf' to '/var/opt/mssql/data/msdbdata.mdf'.
          2018-08-02 10:26:27.61 Server      Setup step is copying system data file 'C:\templatedata\msdblog.ldf' to '/var/opt/mssql/data/msdblog.ldf'.
          2018-08-02 10:26:27.70 Server      Microsoft SQL Server 2017 (RTM-CU9) (KB4341265) - 14.0.3030.27 (X64)    
   Etc..
  </code></pre>
  
  <p><strong>Docker ps</strong></p>
  
  <pre><code>CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS                     NAMES
  7a8c023598d3        diagnostiquesdeconnecte_back    "dotnet Diagnostique…"   4 minutes ago       Up 4 minutes        0.0.0.0:8082-&gt;44318/tcp   diagnostiquesdeconnecte_back_1
  bb60c5ee33cb        diagnostiquesdeconnecte_front   "dotnet Diagnostique…"   4 minutes ago       Up 4 minutes        0.0.0.0:8081-&gt;80/tcp      diagnostiquesdeconnecte_front_1
  8c0ed896eb23        microsoft/mssql-server-linux    "/opt/mssql/bin/sqls…"   4 minutes ago       Up 4 minutes        0.0.0.0:1433-&gt;1433/tcp    diagnostiquesdeconnecte_NDV1289_1
  </code></pre>
  
  <p><strong>Everything seems working fine but when i try to access the site (<a href="http://localhost:8081" rel="nofollow noreferrer">http://localhost:8081</a>) i have the following message from browser "can't reach this page"</strong></p>
  
  <p><strong>And i used also</strong> <code>- docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' bb60c5ee33cb</code> <strong>(bb60c5ee33cb is my container) to obtain an ip adress, and with ip i have same message.</strong></p>
  
  <p><strong>Can you help how can i run my apps using docker ? any sugesstions please. thanks in advance.</strong></p>