I'm trying to add an Azure Function project to a docker-compose file created in Visual Studio 2019 (16.7.6), but this causes the solution to fail to build.
(Docker for Windows 2.4.0.0 (48506), with WSL2 support enabled, running in Linux container mode on Windows 10 Pro 2004)
Steps to reproduce:
- Create a new solution with a Web Api project 'Web' that includes docker support.
- Add a new Azure Function project 'Func' with an Http trigger function and then added docker support via Visual Studio Add > Docker Support option.
- Add 'Container Orchestration Support' to Web project to generate a docker-compose.yml file that has the web app
At this point the solution builds debugging works for the web or func app in docker or docker-compose - all good.
When 'Func' project is added manually to docker-compose.yml the solution no longer builds:
CTC1031 Linux containers are not supported for Func project
Project: docker-compose
File: Microsoft.VisualStudio.Docker.Compose.targets
Line 303
However, I can run docker-compose fine from the command line:
docker-compose -f docker-compose.yml up
and both Web and Func app start up fine.
My docker-compose.yml file is
version: '3.4'
services:
web:
image: ${DOCKER_REGISTRY-}web
build:
context: .
dockerfile: Web/Dockerfile
func:
image: ${DOCKER_REGISTRY-}func
build:
context: .
dockerfile: Func/Dockerfile
Any ideas why I get the above error when building the solution in Visual Studio?