Here, we describe how to create a Microsoft SQL Express 2017 Server service in an Ubuntu Linux operating system based on Docker.
Run new Docker container:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' \
-e 'MSSQL_PID=Express' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest-ubuntu
Enter shell of Docker container:
docker exec -it <Container ID> bash
Create database (within shell of Docker container):
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'yourStrong(!)Password' \
-Q 'create database addressbook;'
Create database table "contacts" within database "addressbook" with required table structure:
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'yourStrong(!)Password' -Q 'create table addressbook.dbo.contacts( id int, first_name varchar(1000), last_name varchar(1000), company_name varchar(1000), email varchar(1000), department varchar(1000), position varchar(1000), address_work1_street1 varchar(1000), address_work1_street2 varchar(1000), address_work1_postal_code varchar(1000), address_work1_city varchar(1000), address_work1_state varchar(1000), address_work1_country varchar(1000), address_private1_street1 varchar(1000), address_private1_street2 varchar(1000), address_private1_postal_code varchar(1000), address_private1_city varchar(1000), address_private1_state varchar(1000), address_private1_country varchar(1000), phone_business varchar(1000), phone_private varchar(1000), phone_mobile varchar(1000), phone_other varchar(1000), fax varchar(1000), birthdate date);'
Create example contact:
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'yourStrong(!)Password' -Q "INSERT INTO addressbook.dbo.contacts (id, first_name, last_name, company_name, email, department, position, address_work1_street1, address_work1_street2, address_work1_postal_code, address_work1_city, address_work1_state, address_work1_country, address_private1_street1, address_private1_street2, address_private1_postal_code, address_private1_city, address_private1_state, address_private1_country, phone_business, phone_private, phone_mobile, phone_other, fax, birthdate) VALUES (1, 'Oliver', 'Byte', 'sync.blue', 'service@sync.blue', 'Product development', 'Product manager', 'Wehrstr. 29', '1. OG', '45721', 'Haltern am See', 'Nordrhein-Westfalen', 'Deutschland', 'Sophie-Test-Strasse 53', '3. OG', '3721', 'Testdorf', 'Hessen', 'Deutschland', '+4923648873040', '+49236494950', '4915149375198', '+25145544633', '+49305443434554', '1982-10-19' )"
Comments
0 comments
Please sign in to leave a comment.