https://github.com/bonddim/go-sqlcmd
go-sqlcmd cli Docker image for Microsoft SQL Server, Azure SQL and Azure Synapse
https://github.com/bonddim/go-sqlcmd
azure-sql go-sqlcmd mssql sql-server sqlcmd
Last synced: 2 months ago
JSON representation
go-sqlcmd cli Docker image for Microsoft SQL Server, Azure SQL and Azure Synapse
- Host: GitHub
- URL: https://github.com/bonddim/go-sqlcmd
- Owner: bonddim
- License: mit
- Created: 2024-05-09T09:01:51.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-28T22:01:47.000Z (4 months ago)
- Last Synced: 2025-03-28T23:21:39.776Z (4 months ago)
- Topics: azure-sql, go-sqlcmd, mssql, sql-server, sqlcmd
- Language: Dockerfile
- Homepage:
- Size: 25.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [go-sqlcmd](https://github.com/microsoft/go-sqlcmd) docker image
[docker-hub]: https://hub.docker.com/r/bonddim/go-sqlcmd
[](https://github.com/bonddim/go-sqlcmd/actions/workflows/docker.yaml)
[][docker-hub]
[][docker-hub]
[][docker-hub]
[](https://github.com/bonddim/go-sqlcmd?tab=MIT-1-ov-file)## About
- Supported architectures: **amd64**, **arm64**, **s390x**
- Uses [gcr.io/distroless/static:nonroot](https://github.com/GoogleContainerTools/distroless) as image base
- Uses [released sqlcmd](https://github.com/microsoft/go-sqlcmd/releases) binary
- Updated automatically by Renovate## Usage
```bash
# Pull image from Docker Hub
docker pull bonddim/go-sqlcmd
# Or GitHub Container Registry
docker pull ghcr.io/bonddim/go-sqlcmd
```Docker container with mounted scripts to run:
```bash
docker run \
--rm \
-v $(pwd)/sql_scripts:/mnt/sql \
-e SQLCMDPASSWORD={{ password }} \
ghcr.io/bonddim/go-sqlcmd \
-i /mnt/sql \
-S {{ server }} \
-d {{ database }} \
-u {{ user }}
```K8s pod with Entra ID authentication:
```yaml
apiVersion: v1
kind: Pod
metadata:
name: go-sqlcmd
labels:
azure.workload.identity/use: "true"
spec:
serviceAccountName: go-sqlcmd
containers:
- name: go-sqlcmd
image: bonddim/go-sqlcmd
args:
- --use-aad
- --server
- {{ server }}.database.windows.net
- --database-name
- {{ database }}
- --query
- {{ query }}
securityContext:
runAsNonRoot: true
...
```Refer to official [docs](https://docs.microsoft.com/sql/tools/go-sqlcmd-utility) for syntax and command line arguments
## License
Inherited from [microsoft/go-sqlcmd](https://github.com/microsoft/go-sqlcmd?tab=MIT-1-ov-file)