Docker Community Forums

Share and learn in the Docker community.

Container missing ports

I’m using the following commands
docker build -t webapi_prod .
docker run -d --name webapi_prod -p 4466:80

when the container is created the ports are missing.

OS - Windows 2016 Version 1607

Your command is incomplete.
Please share the full command.

This is the full command
docker run -d --name webapi_prod -p 4466:80 --restart unless-stopped webapi_prod:latest

Or are you mentioning about the docker file?

Probably yes.
Don’t add a restart parameter at this moment when things are not yet working.

FROM microsoft/aspnetcore

WORKDIR /inetpub/wwwroot
COPY .\ /inetpub/wwwroot

EXPOSE 80/tcp
#EXPOSE 443/tcp
ENTRYPOINT [“dotnet”, “WebApi.dll”]

@dockerfingent, I haven’t created any docker containers using microsoft/aspnetcore, so take the following with a grain of salt. It should be applicable though to both linux and windows containers.

Your question states “when the container is created, the ports are missing,” can you clarify what you mean by the “ports are missing?” Specifically, is the container not starting up with some error message? Or can you not connect to port 4466, which might indicate the container port isn’t listening due to the dotnet webapi.dll not running.

Also, just in case you aren’t aware, the EXPOSE 80/tcp directive in the Dockerfile literally does nothing in terms of making a port accessible on the container. Its sole purpose in life is to document that some process running in the container is listening on TCP port 80. Whether there is some such process listening on that port is really up to you making sure that dotnet webapi.dll is actually listening on that port. I would suggest exec’ing into the container and running something like netstat -a -b -n -o and verifying that there is something listening on tcp/port 80 and that process is your webapi.dll. If it’s listening on some other port, adjust your -p option to point to the correct port.

. This is what i meant by port missing.

Checked the log. This is the error:

It was not possible to find any compatible framework version
The specified framework ‘Microsoft.AspNetCore.App’, version ‘2.1.6’ was not found.
Check application dependencies and target a framework version installed at:
Alternatively, install the framework version ‘2.1.6’.

When i try to pull the images for dot net core, its shows no matching manifest for unknown in the manifest list entries

It got solved by pulling this image
mcr.microsoft.com/windows/servercore:ltsc2016