Docker :: assign different IP address to each container on Synology NAS

I’m getting familiar with Docker thanks to my NAS Syonlogy 1515+.

I have created a SQL Server 2019 container called sqlserver4 that listen on port 1433:

sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=My_Password" -p 1433:1433 --name sqlserver4 -d mcr.microsoft.com/mssql/server:2019-latest

And I have then created a second one called sqlserver5 that listen on port 1533:

sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=My_Password" -p 1533:1533 --name sqlserver5 -d mcr.microsoft.com/mssql/server:2019-latest

All good, my two servers are there at the IP Address 192.168.1.44

enter image description here

I can connect through SSMS to the first one, the sqlserver4:

enter image description here

But when I try to connect to the second one, the sqlserver5 I receive the error:

A connection was successfully established with the server, but then an
error occurred during the pre-login handshake. (provider: TCP
Provider, error: 0 – The specified network name is no longer
available.) (Microsoft SQL Server, Error: 64)

enter image description here

It’s easy to see where the problem is: even if they are on different port, 1433 and 1533 the IP Address is always the same 192.168.1.44

How can I setup a different IP Address for each container?

Source: Docker Questions

LEAVE A COMMENT