I have this simple dockerfile in my VS directory:
FROM microsoft/aspnetcore:2.0-nanoserver-1709
ADD bin/Debug/netcoreapp2.0/publish/ /
ENTRYPOINT myfile.exe
From powershell, I go to the directory with the solution.
I then build the application.
dotnet publish -c Release
Works fine. I then build the image:
docker build -t xpndr.ats.release --build-arg source=bin/Release/netcoreapp2.0/publish .
Works fine as well, I can see the image doing a “docker images”
But when I run the image I get an error that myfile.exe cannot be found.
Correct , it is a core dll. So I change the ENTRYPOINT to [“dotnet”,“myfile.dll”]
I also add a .dockerignore file with the follwoing:
directories
**/bin/
**/obj/
**/out/
files
Dockerfile*
**/.trx
**/.md
**/.ps1
**/.cmd
**/*.sh
And I then rebuild the image
docker build -t xpndr.ats.release --build-arg source=bin/Release/netcoreapp2.0/publish .
ending up with the following error:
Sending build context to Docker daemon 30.72kB
Step 1/3 : FROM microsoft/aspnetcore:2.0-nanoserver-1709
—> 882104b1a10d
Step 2/3 : ADD bin/Debug/netcoreapp2.0/publish/ /
ADD failed: CreateFile \?\C:\ProgramData\Docker\tmp\docker-builder857651318\bin\Debug\netcoreapp2.0\publish: The system cannot find the path specified.
So I removed the .dockerignore, same error
Modified the dockerfile to its original, same error
And what ever I do I always het this error.