Dockertools: Docker Compose build target fails on build since upgrade to VS 15.3

Created on 1 Sep 2017  路  8Comments  路  Source: microsoft/DockerTools

I had a docker-compose working fine, I've not upgraded Visual Studio 2017 (to 15.3.3) and Docker (17.06.1-ce-win24 13025) the dcproj fails:

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(279,5): error : Value cannot be null.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(279,5): error : Parameter name: stream

The offending line is:

<CreateComposeVsGeneratedFiles DockerComposeProjectPath="$(DockerComposeProjectPath)"
                                   DockerDevelopmentMode="$(DockerDevelopmentMode)"
                                   DockerVsDbgPath="$(DockerVsDbgPath)"
                                   DockerMsVsMonPath="$(DockerMsVsMonPath)"
                                   DockerOneCoreMsVsMonPath="$(DockerOneCoreMsVsMonPath)" />

When I loaded the project after updating Visual Studio, it asked me to upgrade the compose files. I agreed and it only changed the version number from 2 to 3.

My compose is:

version: '3'

services:
  mcodatabase:
    image: mcodatabase
    build:
      context: ./Data
      dockerfile: Dockerfile
    restart: always
    ports:
       - 9876:5432
    environment:
      POSTGRES_USER: mcodevuser
      POSTGRES_PASSWORD: password
      POSTGRES_DB: mcodev
    volumes:
     - postgresdata:/var/lib/postgresql/data
    networks:
     - mconetwork

  mcoidentityserver:
    image: mcoidentityserver
    build:
      context: ./Mco.IdentityServer
      dockerfile: Dockerfile
    environment:
      IDENTITY_ISSUER: "http://10.0.75.1:5000"
    ports:
       - 5000:5000
    networks:
     - mconetwork

  mcoapi:
    image: mcoapi
    build:
      context: ./Mco.Api
      dockerfile: Dockerfile
    environment:
      IDENTITY_AUTHORITY: "http://mcoidentityserver:5000"
    ports:
       - 56107:80
    links:
     - mcodatabase
     - mcoidentityserver
    depends_on:
     - "mcodatabase"
     - "mcoidentityserver"
    networks:
     - mconetwork

  mcotestclient:
    image: mcotestclient
    build: 
      context: ./Client
      dockerfile: Dockerfile
    ports:
     - 56108:80
    networks:
     - mconetwork

volumes:
  postgresdata:

networks:
  mconetwork:
     driver: bridge

Most helpful comment

@mphadeuspacy I'm finding this same issue in VS 15.7.3 too.

A workaround I've been able to use is to ensure that Dockerfiles are not at the root level of a project.

So, if your docker-compose contains this:

version: '3'

services:
  myService:
    build:
      context: .
      dockerfile: MyProject/Dockerfile

Move the dockerfile into a subfolder:

version: '3'

services:
  myService:
    build:
      context: .
      dockerfile: MyProject/Docker/Dockerfile

All 8 comments

This is fixed in the 15.4 release that is planned for next week.

Any updates on this issue?
When fix will be released?

This was fixed in 15.4, which was released some weeks ago.

@brainwipe, thanks for the confirmation. @micnyk, this issue was fixed. I'll close this issue for now but open another issue if still having problems after updating to 15.4

I am getting the same issue on VS version 15.7.3

errorvs

See attached with error messages

@mphadeuspacy I'm finding this same issue in VS 15.7.3 too.

A workaround I've been able to use is to ensure that Dockerfiles are not at the root level of a project.

So, if your docker-compose contains this:

version: '3'

services:
  myService:
    build:
      context: .
      dockerfile: MyProject/Dockerfile

Move the dockerfile into a subfolder:

version: '3'

services:
  myService:
    build:
      context: .
      dockerfile: MyProject/Docker/Dockerfile

visual studio for Mac. upgraded to latest version of visual studio 7.5.2

Create a new asp.net mvc project then added docker support then tried to run docker project.

Failed.

What is going on?
I tried moving docker file to subfolder - still doesn't work using a newly created mvc core project.
Can we please bring some stability to the docker support for visual studio for Mac as it has taken many hours to try troubleshoot this issue with no resolution.

version: '3.4'

services:
netcoremvctest:
image: netcoremvctest
build:
context: .
dockerfile: NetCOreMVCTest/docker/Dockerfile

here is the build err:
/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/docker/MonoDevelop.Docker/MSbuild/Sdks/Microsoft.Docker.Sdk/build/Microsoft.VisualStudio.Docker.Compose.targets(5,5): Error MSB4018: The "PrepareForBuild" task failed unexpectedly.
System.ArgumentException: '/Users/michaelmcdonogh/Documents/GIT/aspnetzero5WithXamarinWorking/src/mycompany.TestXamarinApp.Web.Mvc/mycompany.TestXamarinApp.Web.Mvc.csproj' is not a Docker Compose project.
Parameter name: dockerComposeProjectPath
at Microsoft.Docker.DockerWorkspaceProvider.CreateFromDockerComposeProject (System.String dockerComposeProjectPath) [0x0004f] in :0
at Microsoft.Docker.BuildTasks.DockerBuildTask.GetOrCreateDockerWorkspace (System.String dockerComposeProjectPath) [0x00042] in <1e19f33318d64fd1a96291df30d6c4dd>:0
at Microsoft.Docker.BuildTasks.DockerBuildTask.Execute () [0x00075] in <1e19f33318d64fd1a96291df30d6c4dd>:0
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:631
at Microsoft.Build.BackEnd.TaskBuilder+d__26.MoveNext () [0x00212] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:787 (MSB4018) (docker-compose)

Was this page helpful?
0 / 5 - 0 ratings