I have a following file located inside docker container (ubuntu:18.04).
When I try to run it with docker exec -it index_sql /dbrestore/init.sh
, it throws following error
OCI runtime exec failed: exec failed: container_linux.go:380: starting
container process caused: exec format error: unknown
Script inside file:
#!/bin/bash
index_sql /opt/mssql-tools/bin/sqlcmd -i /dbrestore/dbCreate.sql -S 127.0.0.1 -U sa -P PASSWORD
/opt/mssql-tools/bin/sqlpackage /a:Import /sf:/dbrestore/db.bacpac /tsn:localhost,1433 /tdn:index_new /tu:sa /tp:PASSWORD
/opt/mssql-tools/bin/sqlcmd -i /dbrestore/dbPrepare.sql -S 127.0.0.1 -U sa -P PASSWORD
When "/opt/mssql-tools/bin/sqlpackage" line is removed, then it works just fine.
When I try to run
docker exec -it index_sql /opt/mssql-tools/bin/sqlpackage /a:Import /sf:/dbrestore/db.bacpac /tsn:localhost,1433 /tdn:index_new /tu:sa /tp:PASSWORD
or SSH in to the docker container and run
/opt/mssql-tools/bin/sqlpackage /a:Import /sf:/dbrestore/db.bacpac /tsn:localhost,1433 /tdn:index_new /tu:sa /tp:nz6#EvGPkg7UQ9Xq
That all works fine.
Can someone help me and tell me why the following command does not work when when it is located in init.sh file, but works just fine when run manually?