Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2017 15.3 Dockerize Database Project

Have Visual Studio 2017 (15.3) solution with two projects:

  • An API written in ASP.NET Core 2 MVC
  • Database Project

I was able to "dockerize" the MVC project easily (right click, add Docker support) but while trying to dockerize the Database project keep getting the error: Value cannot be null. Parameter name: stream. My Google-fu is failing me; the closest resource found is for Visual Studio 15.2.

How I've Setup Database Project So Far

Added Dockerfile to root:

FROM microsoft/mssql-server-linux:latest
EXPOSE 1433
ENV ACCEPT_EULA=Y
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV MSSQL_TCP_PORT=1433

# Add Database project output from VS build process
RUN mkdir --parents /_scripts/generated
COPY ./_scripts /_scripts/
COPY ./_scripts/generated/*.sql /_scripts/generated/
# Add shell script that starts MSSQL server, waits 60 seconds, then executes script to build out DB (script generated from VS build process)
CMD /bin/bash /_scripts/entrypoint.sh

Modified docker-compose.yml file to include new project

version: '3'

services:
  webapp-api-service:
    image: webapp-api
    build:
      context: ./src/API
      dockerfile: Dockerfile

  webapp-db-service:
    image: webapp-db
    build:
      context: ./src/Database
      dockerfile: Dockerfile

Modified docker-composeoverride.yml file to expose port for dev SSMS access

version: '3'

services:
  webapp-api-service:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
    ports:
      - "80"

  webapp-db-service:
    ports:
      - "1433"

Here's the build output

2>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.
2>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
2>Done building project "docker-compose.dcproj" -- FAILED.

Thanks in advance!

like image 601
James Dudley Avatar asked Nov 19 '25 00:11

James Dudley


1 Answers

I ran into this same issue yesterday. I just solved it by removing the build portion of the database service. I'll just have to build the database project manually for now.

like image 85
dcabines Avatar answered Nov 21 '25 19:11

dcabines



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!