Skip to content

Instantly share code, notes, and snippets.

@giautm
Created August 27, 2024 20:36
Show Gist options
  • Save giautm/4ee03bb62783949749ba7f2ab49394a9 to your computer and use it in GitHub Desktop.
Save giautm/4ee03bb62783949749ba7f2ab49394a9 to your computer and use it in GitHub Desktop.
Generate certs for MSSQL container to bypass issue with Go 1.23
#!/bin/sh
set -e
openssl req -x509 -nodes -newkey rsa:2048 \
-subj '/CN=atlas.ariga.io' \
-days 365 \
-keyout mssql.key \
-out mssql.pem
chmod 440 mssql.pem mssql.key
cat > mssql.conf << EOF
[network]
tlscert = /etc/ssl/certs/mssql.pem
tlskey = /etc/ssl/private-mssql.key
tlsprotocols = 1.2
forceencryption = 1
EOF
docker run --platform linux/amd64 \
-e "ACCEPT_EULA=Y" \
-e "MSSQL_SA_PASSWORD=P@ssw0rd0995" \
-p 1434:1433 \
-v $(pwd)/mssql.conf:/var/opt/mssql/mssql.conf \
-v $(pwd)/mssql.pem:/etc/ssl/certs/mssql.pem \
-v $(pwd)/mssql.key:/etc/ssl/private-mssql.key \
mcr.microsoft.com/mssql/server:2022-latest
rm -f mssql.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment