I am trying to run a SQL Server container on my mac through Docker.
I ran the following command:
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=strongpassword" -p 1433:1433 --name sqlservercontainer -d mcr.microsoft.com/mssql/server:2019-latest
But the container is immediately exiting.
The docker logs for the container look like this:
SQL Server 2019 will run as non-root by default.
This container is running as user mssql.
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
SQL Server 2019 will run as non-root by default.
This container is running as user mssql.
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
/opt/mssql/bin/sqlservr: Error: The system directory [/.system] could not be created. File: LinuxDirectory.cpp:420 [Status: 0xC0000022 Access Denied errno = 0xD(13) Permission denied]
/opt/mssql/bin/sqlservr: Error: The system directory [/.system] could not be created. File: LinuxDirectory.cpp:420 [Status: 0xC0000022 Access Denied errno = 0xD(13) Permission denied]
Any idea what needs to be done to solve this?
2
Answers
If you use the
sudo
command to create a folder outside of your home directory structure for use by Docker then that folder is going to be owned by theroot
user, e.g.:When you try to launch an SQL Server container using a volume mapping with that folder the container will fail to start – because the Docker backend process doesn’t have access – and you will see the "system directory could not be created" error message, e.g.:
To correct the situation you need to give your own account access to the folder and then a container using that volume mapping will start successfully:
If you are having this issue with docker on Synology, SSH into your Synology and update the permissions to your mounted folder.