microsoft / mssql-docker

Official Microsoft repository for SQL Server in Docker resources
MIT License
1.72k stars 758 forks source link

Error 17113, Severity 16, State 1, Error 87 when mounting /var/opt/mssql to tmpfs #297

Open ondreju93 opened 6 years ago

ondreju93 commented 6 years ago

When mounting /var/opt/mssql to a tmpfs, i got the following errors:

2018-04-30 09:36:44.49 Server      Error: 17113, Severity: 16, State: 1.
2018-04-30 09:36:44.49 Server      Error 87(The parameter is incorrect.) occurred while opening file '/var/opt/mssql/data/master.mdf' to obtain configuration information at startup. An invalid startup option might have caused the error. Verify your startup options, and correct or remove them if necessary.

I am runnning the container like that: docker run -d -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=password' -p 1433:1433 --tmpfs /var/opt/mssql:rw --name mssql -v /my-path-to-init-scripts:/import microsoft/mssql-server-linux /import/init.sh

In my case init script does a very basic setup:

#!/usr/bin/env bash
set +x
{
while ! echo -n > /dev/tcp/127.0.0.1/1433; do
    sleep 10
done
sleep 5;
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'password' -i /import/init-sql.sql
} &

/opt/mssql/bin/sqlservr

and init-sql.sql basically creates and sets up a default user for my application

thefringeninja commented 5 years ago

Hi, any chance of someone taking a look at this? Our CI tests against mssql are taking 6-7 minutes and I believe I can cut that in half if I could use tmpfs.

raffig commented 4 years ago

The same here. Any chances that it will be fixed soon?

kieljohn commented 4 years ago

I got around it by a hacky script that creates a 2GB loopback device in memory

dd if=/dev/zero of=/opt/jetbrains/teamcity-mssql-tmpfs/mssql1.img bs=1M count=2048
losetup /dev/loop1 /opt/jetbrains/teamcity-mssql-tmpfs/mssql1.img
mkfs.ext4 /dev/loop1
rm -rf /opt/jetbrains/teamcity-mssql-data1
mkdir /opt/jetbrains/teamcity-mssql-data1
mount /dev/loop1 /opt/jetbrains/teamcity-mssql-data1
chown -R teamcity:teamcity /opt/jetbrains/teamcity-mssql-data1

And the following in the docker-compose.yml

        volumes:
            - /opt/jetbrains/teamcity-mssql-data1:/var/opt/mssql/data

Saw nearly 6-8x the speed of tests in our test runner when using the above vs. running it on a M.2 SSD. We use it for a test runner (so it's all under jetbrains/teamcity directories) but feel free to stick it wherever on your filesystem.

loconox commented 2 years ago

Bump. Facing the same issue !

Related : #110