Score:0

Ubuntu and docker, cannot run executable from bash script

pe flag

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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.