I have trying to learn docker here. I followed the example of this page. https://docs.docker.com/compose/aspnet-mssql-compose/ But when I tried to browse the website using http://localhost:8080. I got an ERR_EMPTY_RESPONSE. It is driving me insane. Can someone pls share some light with me? Thanks Here is my docker-compose.yml
version: "3"
services:
web:
build: .
ports:
- "8080:80"
depends_on:
- db
db:
image: "mcr.microsoft.com/mssql/server"
environment:
SA_PASSWORD: "P@ssword123"
ACCEPT_EULA: "Y"
Dockerfile
FROM microsoft/dotnet:2.1-sdk
COPY . /app
WORKDIR /app
RUN ["dotnet", "restore"]
RUN ["dotnet", "build"]
EXPOSE 80/tcp
RUN chmod +x ./entrypoint.sh
CMD /bin/bash ./entrypoint.sh
entrypoint.sh
#!/bin/bash
set -e
run_cmd="dotnet run --server.urls http://*:80"
until dotnet ef database update; do
>&2 echo "SQL Server is starting up"
sleep 1
done
>&2 echo "SQL Server is up - executing command"
exec $run_cmd
The docker log
> Microsoft.EntityFrameworkCore.Database.Command[20101]
> Executed DbCommand (6ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
> SELECT OBJECT_ID(N'[__EFMigrationsHistory]');
> Executed DbCommand (1ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
> SELECT [MigrationId], [ProductVersion]
> FROM [__EFMigrationsHistory]
> ORDER BY [MigrationId]; [40m[32minfo[39m[22m[49m: Microsoft.EntityFrameworkCore.Migrations[20405]
> No migrations were applied. The database is already up to date. No migrations were applied. The database is already up to date. Done.
> SQL Server is up - executing command Using launch settings from
> /app/Properties/launchSettings.json... [40m[32minfo[39m[22m[49m:
> Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
> User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not
> be encrypted at rest. [40m[32minfo[39m[22m[49m:
> Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
> Creating key {b1de243d-c5cd-4975-96bc-96295c66a905} with creation date 2020-04-11 11:44:06Z, activation date 2020-04-11
> 11:44:06Z, and expiration date 2020-07-10 11:44:06Z.
> [40m[1m[33mwarn[39m[22m[49m:
> Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
> No XML encryptor configured. Key {b1de243d-c5cd-4975-96bc-96295c66a905} may be persisted to storage in
> unencrypted form. [40m[32minfo[39m[22m[49m:
> Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39]
> Writing data to file '/root/.aspnet/DataProtection-Keys/key-b1de243d-c5cd-4975-96bc-96295c66a905.xml'.
> [40m[1m[33mwarn[39m[22m[49m:
> Microsoft.AspNetCore.Server.Kestrel[0]
> Unable to bind to https://localhost:5001 on the IPv6 loopback interface: 'Cannot assign requested address'.
> Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Cannot assign requested address'. Hosting environment:
> Development Content root path: /app Now listening on:
> https://localhost:5001 Now listening on: http://localhost:5000
> Application started. Press Ctrl+C to shut down.