Docker Community Forums

Share and learn in the Docker community.

Any recommendations on how best to use Docker for testing SQL Server scripts


#1

Issue type: query\advice
OS Version/Build: Windows 10
App Version: Docker for Windows version 18.09.0

Hi
I’m new to Docker and apologies if this is the wrong forum, if so please point me at the right one.

What I would like to do is use docker to test new SQL Scripts run against a template SQL Server database (database should be reset each time). I have created a docker container based on the Microsoft SQL Server Developer image which also contains my template SQL Server database and got it attaching when I start the container. I have also created a container with a command script (.cmd) that runs and updates the database, again using the SQL Server developer image so that I have access to SQLCMD. So using two docker commands I can run the two containers which will run the test.

What I’m not sure is how best to automate this (ideally I run it from TeamCity)

My guess is to use docker-compose to run up the two containers where the script container is dependent on the SQL Server container. The odd thing there is the script container will run and terminate when the script has finished, where as the SQL Server container will keep running, so this doesn’t seem quite right. I’m also not sure the best way to return the error state of the script that does the updating.

Thanks for any advice