A
A
artshelom2020-08-24 23:45:48
ASP.NET
artshelom, 2020-08-24 23:45:48

How to give access to a port in docker?

I run *.dll in the docker, but at startup, I can’t figure out how to give access, then when I start asp.core 3.1, I write:

warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]                                                                                                                                     Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
warn:
Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]                                                                                                                                              No XML encryptor configured. Key {ae9989cd-c3b0-42a8-b1b8-a929d303c53d} may be persisted to storage in unencrypted form.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to https://localhost:5001 on the IPv6 loopback interface: 'Cannot assign requested address'.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Cannot assign requested address'.
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001                                                                                                                                                                   info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]

docker itself:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /app
COPY ./bin/Release/netcoreapp3.1 .
ENTRYPOINT [ "dotnet", "HookaServer.dll"]


And I can’t find examples that only with dll (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-08-25
@artshelom

Add to Dockerfile

EXPOSE 5001
EXPOSE 5000

when running
docker exec -it --name cont_name -p 5000:5000 -p 5001:5001 image_name
is an example of course, ports names etc. substitute yours.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question