0

I have installed a mssql server using docker microsoft/mssql-server-linux. It behaves the same as a regular mssql server. i.e my client can access it exactly the same way they access a regular mssql server.

Now I am installing mssql-tools using docker: mcr.microsoft.com/mssql-tools

Looks like in order to use the mssql-tools to access a mssql server (they want sqlcmd/bcp), my client has to run

docker run -it mcr.microsoft.com/mssql-tools

and then run

sqlcmd -S 127.0.0.1 -U sa” 

under a new interface

root@1396d2e50672:

It is not convenient because he has to change all the code where sqlcmd/bcp has been directly called to access the mssql server.

Is it how a container based mssql-tools works? How can I install a mssql-tool container without having the clients change their API?

user389955
  • 9,605
  • 14
  • 56
  • 98

1 Answers1

0

How do you want to run it?

There are multiple strategies here This refers to the server but that contains the tools as well

What I usually do is pass in an entrypoint change the workdir to a volume mount and mount a volume of scripts.

docker run \
    --entrypoint /opt/mssql-tools/bin/sqlcmd \
    -w /mymount  -v ./myscripts:/mymount \
  mcr.microsoft.com/mssql-tools \
    -S 127.0.0.1 -U sa -i myscriptinmymount.sql

Note the options to sqlcmd are passed as usual after the image

untested...

KeepCalmAndCarryOn
  • 8,817
  • 2
  • 32
  • 47
  • Thanks KeepCalmAndCarryOn: I am reading you answer. to answer your question: How do you want to run it? I want to run the mssql-tools and after that, my client will still run sqlcmd -S 127.0.0.1 -U sa the same way as before. They do not need to know if the new Sqlcmd is from the regular mssql-tools or from the docker-based mssql. how I install it is transparent to them. – user389955 Jul 01 '20 at 18:14