Start an sql server container
$ docker run -d -e "ACCEPT_EULA=Y" \
              -e "SA_PASSWORD=MyPassword" \
              -e "MSSQL_DATA_DIR=C:\Program Files\MSSQL\DATA" \
              -p 1433:1433 --name db \
              --mount type=volume,source=hostdata,destination="C:\Program Files\MSSQL\DATA" \
Find the IP address of the container
$ docker inspect db | grep -i "ipaddress";
Connect to the SQL server container from host machine
$ sqlcmd -S,1433 -U SA -P MyPassword;
Get a list of all databases
select name from sys.databases;
Create a new database
create database cityview;
Insert data into the database
use cityview;
create table permit (id int, name varchar(50), module varchar(10));
insert into permit values(1, 'building', 'pr');
insert into permit values(2, 'zoning', 'pl');
select * from permit;
Restore database from backup
restore database cityview from disk= 'db.bak';