Open iqan opened 6 years ago
Can you please share your Dockerfile, .sh script, and .sql script (redacting anything sensitive)?
Here's the repo: mssql-linux-container-test
I've tried again making some changes. It worked on Linux container on Linux machine. But did not work on Linux container on Windows machine.
Also there are chances of inconsistent line ending. I've seen \r
at the end of line in shell script when I edit on windows machine. This maybe the issue.
Check EOL character. It needs to be set to LF only since container runs linux.
yes. did it. But, this will be the issue when created scripts on windows dev machine. And main problem is with the error message, it doesn't provide correct information on what went wrong.
I've been trying to run a SQL script on build time of container. I have a shell script that looks something like this:
echo "Starting SqlServr"
/opt/mssql/bin/sqlservr &
sleep 30 | echo "Waiting for 30s to start Sql Server"
echo "Restoring DB."
/opt/mssql-tools/bin/sqlcmd -U sa -P <valid-password> -i RestoreDb.sql
echo "DB restored."
echo "Deleting backup files."
rm -rf /work/*.bak
I run this from Dockerfile using:
RUN
I'm getting error
': Invalid filename.ql
When I run the same command from shell
/opt/mssql-tools/bin/sqlcmd -U sa -P <valid-password> -i RestoreDb.sql
it works perfectly fine. Also when I replace-i RestoreDb.sql
to-Q <file-content>
it also works perfectly fine.Looks like something to do with
sqlcmd
andbash
.