Yes, you can use Docker/Sail with an existing MSSQL database. You just need to set the correct environment variables in your Dockerfile or in your .env file. Here's an example of how to do it in your .env file:
DB_CONNECTION=sqlsrv
DB_HOST=your-mssql-server
DB_PORT=1433
DB_DATABASE=your-database-name
DB_USERNAME=your-database-username
DB_PASSWORD=your-database-password
Make sure to replace the values with your own database information. Once you have set the environment variables, you can run your Docker container without spinning up a database by removing it from your Dockerfile or docker-compose.yml file.
If you're using Laravel Sail, you can also set the environment variables in your sail.php file:
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'your-mssql-server'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'your-database-name'),
'username' => env('DB_USERNAME', 'your-database-username'),
'password' => env('DB_PASSWORD', 'your-database-password'),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
Again, make sure to replace the values with your own database information.