SQL Server 2022 for docker changed quite few things, among others the container is no longer running as root but as mssql following the least privilege principle, this also means that the container wont be able to make any changes on the docker host which is what causes this problem.
SQL Server 2022 will run as non-root by default. This container is running as user mssql. Your master database file is owned by mssql. To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216. PalInstanceId: Unable to read instance id from file. /opt/mssql/bin/sqlservr: PAL initialization failed. Error: 101 /opt/mssql/bin/permissions_check.sh: line 4: [: : integer expression expected /opt/mssql/bin/permissions_check.sh: line 59: [: : integer expression expected
Possible solution - check your volume mappings
Since this error most likely are caused by permissions your container is trying to perform unallowed operations on the host you might be mapping volumes between the container and host in a bad way.
E.g
docker run ` --name sqlexpress ` -e ACCEPT_EULA=Y ` -e MSSQL_SA_PASSWORD="averyuRandomPass0wrd" ` -p 1433:1433 ` -v "/var/lib/docker/mssql/data:/var/opt/mssql" ` -e MSSQL_PID="Express" ` -d mcr.microsoft.com/mssql/server:latest
In this example the entire mssql folder is shared between the container and the host which isn't recommended anymore.
Instead map specific volumes
docker run ` --name sqlexpress ` -e ACCEPT_EULA=Y ` -e MSSQL_SA_PASSWORD="averyuRandomPass0wrd" ` -p 1433:1433 ` -v "/var/lib/docker/mssql/data:/var/opt/mssql/data" ` -v "/var/lib/docker/mssql/log:/var/opt/mssql/log" ` -e MSSQL_PID="Express" ` -d mcr.microsoft.com/mssql/server:latest
In this example I map just the data and log directories.
This may resolve the error.
