First off I'm using .NET 4.6.1. Does Docker with VS 2017 not work with anything but .NET Core?
I used the new feature Add > Docker Support
from the context menu, and it created a bunch of files. Here's my Dockerfile (haven't touched it since it was auto-created):
FROM microsoft/windowsservercore
ARG source
WORKDIR /app
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["C:\app\nameofmyapp.exe"]
When I build, I get the following error:
The "CleanWorkspace" task failed unexpectedly. Microsoft.DotNet.Docker.CommandLineClientException: The Compose file '...\docker-compose.yml' is invalid because: services.pas.parsemicroservice.build.context contains null, which is an invalid type, it should be a string.
Here's my docker-compose.yml file:
version: '2.1'
services:
pas.parsemicroservice:
image: pas.parsemicroservice
build:
context:
dockerfile: Dockerfile
If I add a .
to context (as the error implies the null
there is the problem), I get a different error:
There is a circular dependency in the target dependency graph involving target "DockerCleanServiceReferences".
Is this all a result of using the wrong .NET framework, or are my files set up wrong? (I am a Docker n00b to be sure.)
Update: Regarding your circular dependency issue, make sure your SLN and CSPROJ files are not in the same folder. Meaning that when you first create a solution, make sure to check the box that says "create directory for solution".
Docker support for non .Net Core applications is definitely supported in VS 2017 as shown at the 9:15 mark of this video https://channel9.msdn.com/Events/Visual-Studio/Visual-Studio-2017-Launch/T111
Your
context
should point to the directory where yourDockerfile
exists. This path should be relative to where your docker-compose.yml file is located.Compose file version 2 Reference: https://docs.docker.com/compose/compose-file/compose-file-v2/#context