Wednesday, July 21, 2021

Official Docker Tutorial issues

The docker web site has given a tutorial at "Dockerize an ASP.NET Core application". I think this tutorial is based on older versions of .net /.net core and hence if you follow the exact steps, you may encounter some issues. 

The first issue is directory structure, either the docker runtime or the msbuild, whosoever it is, requires the docker file to be one level up of the folder in which .csproj file is placed. The above tutorial does not take this into account and hence you are most likely encounter an error of project file missing. 

It also has a statement "COPY  ../engine/examples ./", the engine/example looks cryptic, I have never seen this kind of folders in a .NET project. 

I also encountered an environment issue. In my machine, the command "dotnet new webapp -o xxxx" always created a .NET framework project rather than .NET Core Web App. This gave issues while building. 

So finally I chose a shortcut, I created a docker enabled web project from Visual Studio 2019 . This gave me an auto-generated dockerfile. But again when running from visual studio, I encountered the error "Visual Studio requirds docker to be running". The solution I found was to start the devenv.exe from bash shell, but I could not start it from bash, it gave me unrecongised command. But fortunately , the auto-generated file could run from command line and it gave me some guidance on dockerising the app. 

So my next post will be a step by step guide of creating hello world web app and running it from docker, all from command line. 

No comments:

Post a Comment

How to check local and global angular versions

 Use the command ng version (or ng v ) to find the version of Angular CLI in the current folder. Run it outside of the Angular project, to f...