docker pull microsoft/mssql-server-linux:2017-latest
sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=internship_user'
-p 1535:1433 --name sql1
-d microsoft/mssql-server-linux:2017-latest
docker ps -a
sudo docker exec -it sql1 /opt/mssql-tools/bin/sqlcmd
-S localhost -U sa -P 'intership_user'
-Q 'ALTER LOGIN SA WITH PASSWORD="internship_user_NEW_PASSWORD"'
docker exec -it sql1 'bash'
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'internship_user'
CREATE DATABASE InternshipProject
USE InternshipProject
SELECT Name from sys.Databases
SELECT Name from sys.Tables
CREATE TABLE test ( id INT, name NVARCHAR(50), quantity INT )
CREATE TABLE audio ( id INT IDENTITY(1,1) PRIMARY KEY, name NVARCHAR(50), blobdata VARBINARY(MAX))
INSERT INTO test values (1, 'sasha', 10)
GO
quit exit
docker stop sql1
docker rm sql1
docker images -a
docker rmi <hashid>
cd /backend/db_scripts
tar -c * | docker exec -i sql1 /bin/tar -C /tmp -x
move in /tmp folder where the files where copied and run
../opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'P@ssw0rd' -i ./UpdateDb.sql
- apt-get update (to update linux advance package tool)
- apt-get install vim
- use vim to write in the seed.sh script file:
'../opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'internship_user' -i ./UpdateDb.sql' command
- chmod +x seed.sh (to give permission to execute file)
- run the files:
./script.sh