I have following docker file and docker-compose, it's build and created container images fine through CLI without any problem, however when I try to build it through VS2019 for debugging purpose, it gives an error and I tried to rebuild the project to check where it goes wrong but I could not figure it out. I hope someone point me to the right direction for troubleshooting:-
Docker file:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
# Copy necessary files and restore as distinct layer
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
COPY --from=build-env /app/out .
# Expose ports
EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000
HEALTHCHECK --interval=30s --timeout=3s --retries=1 CMD curl --silent --fail http://localhost:5000/hc || exit 1
# Start
ENTRYPOINT ["dotnet", "VehicleManagementAPI.dll"]
Docker-compose file:
services:
vehiclemanagementapi:
image: urgen/vehiclemanagementapi:1.0
build: src/VehiclemanagementAPI
depends_on:
- rabbitmq
- sqlserver
ports:
- "5000"
environment:
- ASPNETCORE_ENVIRONMENT=Production
It is not a particular project has a issue building/compiling docker-compose file rather it happens with all of the projects. As I said it works fine through CLI without any problem, but there has a issue with one particular project, which I wanted to debug in VS2019.
All of the projects build/work fine without dockerize, which means my projects is Okay but issue is with docker-compose or docker file.
Error :
Severity Code Description Project File Line Suppression State
Error CTC1000 (Line: 45, Col: 12, Idx: 954) - (Line: 45, Col: 36, Idx: 978): Exception during deserialization docker-compose C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets 304