Docker Community Forums

Share and learn in the Docker community.

Failed to deploy my asp.net core webapp to docker!

Environment:
1.Win10 pro system
2.Docker for windows installed, and enable all local drives available to containers.
3.DockerVSTools.VS140.exe installed.
Repro steps:
1.create a new asp.net core web site project with targe 4.6 tframework and named core
2.build the project, right click the project and add Docker Support, then the default Dockerfile(incloud other xxx.yml files) added.
3.update the dockerfile as below:
FROM microsoft/aspnetcore
WORKDIR /app
COPY . /app
ENTRYPOINT [“dotnet”, “core.dll”]
4. publish this project whit default settings.
5.open my PowerShell, and verified all environment of docker, it worked well.
6. type below commands in the PowerShell:
a. cd E:\coreProject\core\src\core\bin\Release\PublishOutput
b. docker build -t james .
Sending build context to Docker daemon 9.653 MB
Step 1 : FROM microsoft/aspnetcore
—> f09dba2102ab
Step 2 : WORKDIR /app
—> Using cache
—> 17ecf172fb0b
Step 3 : COPY . /app
—> Using cache
—> 3b990b78a42e
Step 4 : ENTRYPOINT dotnet core.dll
—> Using cache
—> 4a9fa98dd010
Successfully built 4a9fa98dd010
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have ‘-rwxr-xr-x’ permissions. It is recommended to double check and reset permissions for sensitive files and directories.
c.docker run -d -p 8000:80 james
24a80aa512ca704c970c6647decc93502820cdc07c73907e09bd7dba5173372d
expect:
1.can access the http://localhost:8000 successfully.
actual:
1.can’t access http://localhost:8000
investigation:
we expect that we can access the website after above steps, and we can use “docker ps -a” to make sure the the port 8000 is listening.type “docker ps -a” in PowerShell
show:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
24a80aa512ca james “dotnet core.dll” 4 minutes ago Exited (131) 4 minutes ago amazing_thompson
the PORTS column is null, it maybe tell that i am failed.

So, who can help to fix this problem to let me access the website which i want to run in Docker!
Or, who can point out which step I did is wrong!!
thanks in advanced!!!

What’s the log output if you try running your james container without -d?