Reputation: 7726
Environment:
Windows 10 Enterprise
Visual Studio Professional 2017
Docker CE 18.03.1-ce-win65 (17513)
When I create a solution and add Docker support, VS2017 creates a docker-compose project and adds docker-compose.yml and docker-compose.override.yml. Is there a difference between the two files? Reason I ask is I was trying to set an environment variable on a per container basis.
If I do this in the docker-compose.override.yml file as:
services:
webapplication1:
environment:
- TEST=HELLO1
ports:
- "80"
It builds and works as expected.
If I do it in docker-compose.yml as:
services:
webapplication1:
image: compositeapp
environment:
- TEST=HELLO1
build:
context: .\WebApplication1
dockerfile: Dockerfile
Now it no longer builds and gives me an error:
Severity Code Description Project File Line Suppression State Error (Line: 6, Col: 7, Idx: 73) - (Line: 6, Col: 7, Idx: 73): Expected 'MappingStart', got 'SequenceStart' (at Line: 6, Col: 7, Idx: 73). docker-compose C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 294
Why do some things need to go in the main file and some in the override? From documentation I've seen, there's generally only the main compose file. Is the override a VS2017 specific thing?
Upvotes: 0
Views: 725
Reputation: 601
That was an bug in a specific build of the Docker tooling in VS, it is fixed in 15.8 preview 3 or later. You can choose to upgrade or use the workaround mentioned here: https://github.com/Microsoft/DockerTools/issues/98
Upvotes: 0