Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flcdrg/wait-for-mssql
Wait for Microsoft SQL Server to be ready to accept connections
https://github.com/flcdrg/wait-for-mssql
docker hacktoberfest sql-server
Last synced: 11 days ago
JSON representation
Wait for Microsoft SQL Server to be ready to accept connections
- Host: GitHub
- URL: https://github.com/flcdrg/wait-for-mssql
- Owner: flcdrg
- License: apache-2.0
- Created: 2022-07-23T05:58:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T23:49:22.000Z (4 months ago)
- Last Synced: 2024-10-15T07:10:32.936Z (4 months ago)
- Topics: docker, hacktoberfest, sql-server
- Language: Shell
- Homepage: https://hub.docker.com/r/flcdrg/wait-for-mssql
- Size: 127 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wait for MSSQL
![Docker Image Version (latest semver)](https://img.shields.io/docker/v/flcdrg/wait-for-mssql)
A script that can be run as a Docker image, which waits for a Microsoft SQL Server instance to be ready to accept connections.
When you run SQL Server in a container, it is common for the container to indicate it has started, but in fact, SQL Server is still loading databases. Trying to connect at this time to a specific database would fail.
This script waits until all databases are online. When databases are online they are ready to be used.
If it succeeds it returns 0, but if it fails to connect after a certain number of attempts it returns 1.
## Parameters
- `--server` - the name of the server hosting SQL Server
- `--username` - username
- `--password` - password
- `--delay` - how many seconds to wait between attempts (defaults to 3)
- `--max` - maximum number of connection attempts to make (defaults to 10)## Examples
Connect to a default instance running on `localhost` with username `sa` and password `yourStrong(!)Password`
```bash
docker run flcdrg/wait-for-mssql:latest
```When run on a Linux host, you need to use the [--add-host parameter](https://docs.docker.com/reference/cli/docker/container/run/#add-host):
```bash
docker run --add-host=host.docker.internal:host-gateway flcdrg/wait-for-mssql:latest
```Connect to a default instance running on `myserver` with username `flcdrg` and password `mySuperPassword(!)`
```bash
docker run flcdrg/wait-for-mssql:latest --server myserver --username flcdrg --password mySuperPassword(!)
```Connect to an instance running on `myserver` on port 8000 with username `sa` and password `yourStrong(!)Password`
```bash
docker run flcdrg/wait-for-mssql:latest --server myserver,8000
```