MS SQL Server - Docker

About

docker image of SQL Server

List

Management

The below statements use the SQL Server on Linux for Docker Engine: microsoft/mssql-server-linux

Create a container

  • Bash
docker run \
    -e 'ACCEPT_EULA=Y'  `#Accept the license term` \
    -e 'SA_PASSWORD=TheSecret1!' `#Strong password at least 8 characters including uppercase, lowercase letters, base-10 digits and/or non-alphanumeric symbols. ` \
    -p 1433:1433 \
    -d  `# Daemon` \
    --name sqlserver `#Container Name` \
    microsoft/mssql-server-linux:2017-latest
  • Dos
docker run ^
    -e "ACCEPT_EULA=Y"  ^
    -e "SA_PASSWORD=TheSecret1!" ^
    -p 1433:1433 ^
    -d   ^
    --name sqlserver  ^
    microsoft/mssql-server-linux:2017-latest

Start, stop the container

Docker - Containers

docker start mssql_server
docker stop mssql_server

Connect

docker exec \
    -it mssql_server \
    /opt/mssql-tools/bin/sqlcmd \
    -S localhost \
    -U sa \
    -P TheSecret1!

Powered by ComboStrap