DanWahlin / AspNetCorePostgreSQLDockerApp

ASP.NET Core with PostgreSQL Docker App Demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Attach volume required?

zemien opened this issue · comments

commented

I'm testing out manual linking using the following command but it fails with an error that it cannot find a .sln or .csproj to build:

# docker run -d -p 5000:5000 --link my-postgres:postgres [yourDockerHubID]/dotnet:1.0.0

I resolved it by attaching a volume to it, by adding -v $(pwd):/var/www/aspnetcoreapp whereby the current directory is where the .csproj file is. It didn't work if my present directory was where the .sln is.

The issue is: Is there a scenario where the given code snippet should work, without me having to add a volume?

That's correct. If you're running the development version then it wouldn't know where to find the code to build unless you (a) copy the code into the image or (b) use a volume to point to the project. That's something shown in the Pluralsight course if that's what you're following along with - sounds like you already figured it out though so great job!