3

I created a new .NET Core Console Application with Visual Studio 2017 (RTM). Then added Docker support and got the docker file + compose files just fine. However there are few issues with them.

Docker compose files have version 2 which makes the build fail to the following error message

Microsoft.DotNet.Docker.CommandLineClientException: client version 1.22 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version.

This can be fixed by manually changing the compose file versions to 2.1. (not sure if valid fix) Then you'll get another error message

MSB4006 There is a circular dependency in the target dependency graph involving target "DockerCleanServiceReferences".

This I have no idea how to fix. I know the error message is due to some configuration that causes circular reference (e.g. post build event that does build)

So, any resources or tips how to package the .NET Core console application into docker container manually? I'm just getting to know Docker so don't assume I know anything of it yet.

Another question, that is there some place where I could get updated versions of these Visual Studio templates or are these known issues?

5 Answers 5

2

It turned out the problem for me was having my DockerFile, SLN file, and CSPROJ file all in the same folder. You know how when you create a solution, it asks you if you want to create a subdirectory? If you do not, and your SLN and CSPROJ files share the same folder, inevitably the Docker files will be added to this same folder, creating the circular reference. If your SLN file lives in the directory above your CSPROJ file, the DockerFile et al will be put into your parent directory with the SLN file, and all will be well. This solved it for me.

Sign up to request clarification or add additional context in comments.

1 Comment

I said yes to creating a subdirectory and my .sln is in the folder above the .csproj but the Dockerfile is created in the same folder as the csproj
2

Can you please check if your Docker for Windows is targeting Linux? It's likely you were targeting Windows container, which is not supported with .NET Core yet.

1 Comment

I had Docker for Windows targeting Windows, but I changed it to Linux and no change on the actual build error. Still getting error for circular dependency. Also the compose-vs.release/debug.yml file has label ...targetoperationsystem=linux
1

On my first spin of VS2017 with docker, using the default template, I ran in to the same issue. I referred to this article - https://blogs.msdn.microsoft.com/containerstuff/2017/03/13/visual-studio-2017-client-version-1-22-is-too-old/ This is what worked for me - As recommended, made this changes in docker-compose project's docker-compose.ci.build.yml : The 'version' parameter on the top of the file which was set to 2, was change to 2.1 Repeated the same changes on the other files in the project including:

docker-compose.yml

docker-compose.override.yml

docker-compose.vs.debug.yml

docker-compose.vs.release.yml

Comments

0

Regarding your question on how to package a .NET Core console application into a Docker image manually. The https://github.com/dotnet/dotnet-docker-samples are intended to answer that very question. Check them out. If you run into issues with them or have suggestions please log an issue (https://github.com/dotnet/dotnet-docker-samples/issues).

Comments

-2

Thanks for the post. We will be adding Nano Server container tooling "soon". Until then, you can work with Linux containers which will give a similar experience.

2 Comments

See my comment to David's answer. Switched to Linux and still not working? Is there something else I need to do?
I had Linux containers by default, got this error, tried switching to Windows containers, no change -- got the error still.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.