FROM microsoft/nanoserver WORKDIR c:/ RUN DIR COPY /bin/Debug/ /ConsoleApp2/ RUN DIR C:\ConsoleApp2 CMD ["C:\\ConsoleApp2\\ConsoleApp2.exe","",""]However when i executed the command docker build -t consoleapp2:dev . an error showed up: GetFileAttributesEx bin\\Debug\: The system cannot find the path specified. saying that the folder could not be found when actually the folder was there. So I digged into the .dockerignore file that accompanies the Dockerfile when I added it through Visual Studio. Inside the file there's a bunch of patterns that filter out related files or directories, so i removed everything from that file and run the Docker build command, the next thing you know it was a successful run.
* (Culprit) !obj\Docker\publish\* !obj\Docker\empty\Only obj folder get copied over.
A successful run.
Sending build context to Docker daemon 123.9 kB Step 1/6 : FROM microsoft/nanoserver ---> 4a8212a9c691 Step 2/6 : WORKDIR c:/ ---> Using cache ---> ebcfa5b95aa7 Step 3/6 : RUN DIR ---> Using cache ---> 6dfa39dc1b7b Step 4/6 : COPY /bin/Debug/ /ConsoleApp2/ ---> fb65c840b3eb Removing intermediate container 8eb904bad33a