Feeds:
Posts
Comments

Archive for the ‘ASP.NET Core’ Category

In last blog I discuss about running sql server inside container while asp.net core web api on host (windows) machine. I can connect SQL server while running asp.net core web api however can not connect using management studio from host machine.

I tried various option like localhost : port number (localhost:1433) or container ip address : port number (XXX.XXX.XXX.XXX:1433) with no success.

After few unsuccessful trial I decided to read docker documentation windows and while reading carefully I noticed that “you can not connect linux container from windows host neither you can ping your linux container”. Here is the reference link https://docs.docker.com/docker-for-windows/networking/ 

It is better to read basic before starting any new technology !

Happy Programing !!

Read Full Post »

I am playing around docker container from last couple of days on my windows machine with docker desktop tool, seems to be fairly simple and working fine. I decided to go to next step where I want to connect asp.net core web api to SQL server running inside docker container.

Reading docker material and surfing internet, I found a simple command to download and run SQL Server Ubuntu/Linux container. Here is the syntax I used,

docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=MySuperStrongPassword1!' -p 1432:1433 --name sqltest -d mcr.microsoft.com/mssql/server:2017-latest-ubuntu

Command ran successfully and I can see container from “docker ps -a” and in docker dashboard.

However containers stop working with status EXITED (1). Every time I start container either from command prompt or docker dashboard it automatically stops with status Exited (1).

What went wrong !! The command is very simple and I typed it correct too. After reading few articles over internet I found issue at https://github.com/Microsoft/mssql-docker/issues/199

According to Github, if you are working on windows command prompt or powershell , you should use double quote instead of single quote. The correct command is

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=MySuperStrongPassword1!" -p 1432:1433 --name sqltest -d mcr.microsoft.com/mssql/server:2017-latest-ubuntu

Explanation

When you run SQL server withing container you must accept terms and condition. The argument -e “ACCEPT_EULA=Y” does the same thing however when you use single quote instead of double quote, it does not set condition acceptance to true and hence SQL container stops.

Happy Programming !!

Read Full Post »