![]() In this example, we set UID 10001 as the non-root user. This can be the default non-root user, or any other non-root user you'd like to specify. Set the non-root user as the owner of the files Grant the root group permissions to the following directories so that the non-root SQL Server container has access to database files. Grant the root group read/write access to the database files Run one of the following commands if SQL Server doesn't have access to persisted database files. You can get the current ownership of the database files with this command. To allow the non-root user to access database files that are on mounted volumes, make sure that the user or group you run the container under, can read from and write to the persistent file storage. docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=MyStrongPassword" -cap-add SYS_PTRACE -u $(id -u myusername):$(id -g myusername) -v /path/to/mssql:/var/opt/mssql -p 1433:1433 -d /mssql/server:2019-latestĬonfigure persistent storage permissions for non-root containers In this example, the mounted volume has permissions configured for the user or group on the host machine. You can start SQL Server with a custom user and group. ![]() You can start SQL Server with an existing user on the host machine with the following command: docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=MyStrongPassword" -cap-add SYS_PTRACE -u $(id -u myusername):0 -p 1433:1433 -d /mssql/server:2019-latest docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=MyStrongPassword" -u 0:0 -p 1433:1433 -d /mssql/server:2019-latest You can run the non-root container as the root user if necessary, which also grants all file permissions automatically to the container, because it has higher privilege. Run the non-root container as the root user ![]() You can check if the SQL Server container is running as a named user by running whoami within the container. Make sure that the SQL Server container has a named user such as mssql or root, otherwise sqlcmd will not be able to run within the container. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |