Local path: C: \ code \ referencecode \ SAP kyma tutorial example
This sample provides the MS SQL database configured with a sample
DemoDBdatabase which contains one
Orderstable populated with two rows of sample data.
This example shows how to create an MSSQL database named demodb, a database table named orders, and two rows of test data.
app/setup.sql file handles the generation of the database, table, and data.
Setup.sql in the app folder is responsible for creating databases, database tables and test data.
app/init-db.shfile, you can also configure the database user and password.
The init-db.sh file is used to configure the database user name and password.
- FROM:The FROM instruction initializes a new build stage and sets the Base Image for subsequent instructions. As such, a valid Dockerfile must start with a FROM instruction. The image can be any valid image – it is especially easy to start by pulling an image from the Public Repositories.
Dockerfile is used to create a docker image. The last line of command executes the entrypoint.sh file under the app folder.
Build the Docker image
Build an image according to dockerfile:
Enter the following folder:
C: \ code \ referencecode \ SAP kyma tutorial example \ database MSSQL
Execute command line:
docker build -t i042416/mssql -f docker/Dockerfile .
Note that because the image name based on is Microsoft / MSSQL server linux, this command should be completed in the Linux operating system:
Image creation completed successfully:
After the docker image is created, upload it to the docker hub:
docker push i042416/mssql
Run this image locally:
sudo docker run -e ACCEPT_EULA=Y -e SA_PASSWORD=Yukon900 -p 1433:1433 –name sql1 -d i042416/mssql
Go inside the image and open bash shell:
docker exec -it sql1 “bash”
Start the sqlcmd tool, which allows you to run queries against the database, by running this command: /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Yukon900
Enter the following query command:
1> USE DemoDB 2> SELECT * FROM ORDERS 3> GO
Result: two order data were successfully read:
In the / usr / SRC / APP folder inside docker, I did find the file when I made the docker image:
Microsoft SQL server, installed in / opt Directory:
More Jerry’s original articles are: “Wang Zixi”: