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 !
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,
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).
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
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.