0

I am using the latest Docker version (17 CE) on a Mac OSX and I have spun up an instance of SQL Server using the following tutorial: https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-setup-docker

The server was set up successfully and I managed to connect to it from outside the container via an SQL command line utility.

The next step is that I want to be able to connect to this instance from another PC within the same local network by assigning a public IP to the instance.

I have looked through a number of tutorials and it seems that with docker 10 this functionality is now possible, so I am looking to do it the 'right' way rather than the hacky way (pre-docker 10). I have looked through a number of tutorials namely How to assign static public IP to docker container and Assign static IP to Docker container.

I was testing using the ubuntu image to stay true to the example, but it still didn't work. Although the image ran, whenever I tried to ping the assigned IP from the same computer docker is installed on, I was not receiving a request timeout. Also on Kitematic the only host under IP AND PORTS is localhost. The image is being assigned to the custom network (docker network prune while instance is running does not prune my custom network) but I can't seem to discover my instance from the outside.

Commands I am using are

$ docker network create --subnet=172.18.0.0/16 mynet123
$ docker run --net mynet123 --ip 172.18.0.22 -it ubuntu bash
$ ping 172.18.0.22

and for my sql server

$ docker network create --driver=bridge --subnet=192.168.0.0/24 --gateway=192.168.0.1 mynet
$ docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=MyPassword123<>' -p 1433:1433 --ip=192.168.0.10 --net=mynet microsoft/mssql-server-linux
$ ping 192.168.0.10

What am I missing?

Any help would be appreciated.

Community
  • 1
  • 1
Nik
  • 355
  • 1
  • 7
  • 18
  • Are you able to connect sql server using mssql utility? – Kannan Kandasamy May 11 '17 at 15:35
  • Tagging it to SQL Server Vnext – Kannan Kandasamy May 11 '17 at 15:36
  • I am using SquirrelSQL to connect to the DB. I just used the following commands `$ docker network create --subnet=172.18.0.0/16 mynet123` and `docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=PaSsWoRd!' -p 1433:1433 --ip=172.18.0.22 --net=mynet123 microsoft/mssql-server-linux` and I couldn't connect to the DB via squirrel. I saw these lines during startup `2017-05-11 15:54:30.06 spid19s Server is listening on [ 0.0.0.0 1433]. 2017-05-11 15:54:30.07 Server Server is listening on [ 127.0.0.1 1434].` My custom IP is not there. – Nik May 11 '17 at 16:12
  • This is the command I use to connect to the MSSQL instance `jdbc:sqlserver://172.18.0.22:1433;databaseName=DEV1`. This fails, but as soon as I change it to `jdbc:sqlserver://localhost:1433;databaseName=DEV1` I connect fine. – Nik May 11 '17 at 16:19

0 Answers0