Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server LocalDB inside the docker container

I need dockerized database that supports T-SQL and some other things of SQL Server. Of course, there is a container with SQL Server but it takes too much space. So I try to put SQL Server LocalDB (about 200mb) in a docker container.

It has silent mode of installation and can be easily installed. But the problem is how to access it from outside the container? (I need to access it from my local PC too) Is there any solution for this case? For now I have only one idea to implement some service for communication between SQL Server LocalDB and external connections then expose it near the db in the same container. Could you guys please advise something?

like image 416
Serg046 Avatar asked Mar 31 '18 22:03

Serg046


People also ask

Can I run SQL Server in a Docker container?

With Docker, you can also run multiple SQL Server Containers on the same host machine.

Where is LocalDb stored?

The system database files for the database are stored in the local AppData path, which is normally hidden. For example, C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\LocalDBApp1\ .

Can you put a database in a Docker container?

You can use Docker to run a database in a container as if it were a remote server, and test how your application interacts with it. This tutorial describes how to run a Docker container with a PostgreSQL server and connect to it using IntelliJ IDEA.


1 Answers

Localdb only allows named pipes connections from the machine it is running on. You can use SQL Server Express, 400 MB, which allows TCP connections

like image 115
ErikEJ Avatar answered Sep 18 '22 23:09

ErikEJ