Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied when persisting a container of mcr.microsoft.com/mssql/server:2019-latest using Docker volumes

On Windows 10, using Docker desktop version 2.1.0.5.

I have been successfully using the image microsoft/mssql-server-linux:2017-latest, but since it is deprecated, I am changing it to mcr.microsoft.com/mssql/server:2019-latest, where I experience issues.

I am defining the database service as:

version: '3.4'

services:

  sql.data:
    container_name: tvq_db
    image: mcr.microsoft.com/mssql/server:2019-latest

    environment:
      - SA_PASSWORD=Pass_word
      - ACCEPT_EULA=Y

    ports:
      - "1433:1433"

    volumes:
      - ${APPDATA}/MyServiceDB/mssql:/var/opt/mssql

Using this setup, my ASP.NET Core application fails to connect to the database service, and when I check the logs of the database container, I see many Permission denied errors. The log is as following:

This program has encountered a fatal error and cannot continue running at Thu Jan 23 19:35:01 2020
SQL Server 2019 will run as non-root by default.
The following diagnostic information is available:

         Reason: 0x00000006
This container is running as user mssql.
        Message: Kernel bug check
        Address: 0x6b847e90
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
     Parameters: 0x10861f590

    Stack Trace:
                 000000006b9358de
Ubuntu 16.04.6 LTS
                 000000006b847eeb
                 000000006b83457e
Capturing core dump and information to /var/opt/mssql/log...
                 000000006b843155
                 000000006b843326
                 000000006b933bac
                 000000006b93271f
                 000000006b975c31
        Process: 12 - sqlservr
         Thread: 16 (application thread 0x4)
    Instance Id: 30c43f95-99ae-4690-b94b-4dea47909601
       Crash Id: d810733f-44af-473f-a5b1-13e26bc9d3cd
    Build stamp: 560c56ee7000c721a5dff27fa44f6ea8b3c72562060679d6d4790e8389f46953
   Distribution: Ubuntu 16.04.6 LTS
     Processors: 2
   Total Memory: 2096144384 bytes
      Timestamp: Thu Jan 23 19:35:01 2020
     Last errno: 2
Last errno text: No such file or directory
/bin/cat: /proc/12/maps: Permission denied
/bin/cat: /proc/12/environ: Permission denied
/usr/bin/find: '/proc/12/task/12/fd': Permission denied
/usr/bin/find: '/proc/12/task/12/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/12/ns': Permission denied
/usr/bin/find: '/proc/12/task/13/fd': Permission denied
/usr/bin/find: '/proc/12/task/13/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/13/ns': Permission denied
/usr/bin/find: '/proc/12/task/14/fd': Permission denied
/usr/bin/find: '/proc/12/task/14/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/14/ns': Permission denied
/usr/bin/find: '/proc/12/task/15/fd': Permission denied
/usr/bin/find: '/proc/12/task/15/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/15/ns': Permission denied
/usr/bin/find: '/proc/12/task/16/fd': Permission denied
/usr/bin/find: '/proc/12/task/16/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/16/ns': Permission denied
/usr/bin/find: '/proc/12/task/17/fd': Permission denied
/usr/bin/find: '/proc/12/task/17/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/17/ns': Permission denied
/usr/bin/find: '/proc/12/task/18/fd': Permission denied
/usr/bin/find: '/proc/12/task/18/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/18/ns': Permission denied
/usr/bin/find: '/proc/12/task/19/fd': Permission denied
/usr/bin/find: '/proc/12/task/19/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/19/ns': Permission denied
/usr/bin/find: '/proc/12/task/20/fd': Permission denied
/usr/bin/find: '/proc/12/task/20/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/20/ns': Permission denied
/usr/bin/find: '/proc/12/task/21/fd': Permission denied
/usr/bin/find: '/proc/12/task/21/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/21/ns': Permission denied
/usr/bin/find: '/proc/12/task/22/fd': Permission denied
/usr/bin/find: '/proc/12/task/22/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/22/ns': Permission denied
/usr/bin/find: '/proc/12/task/23/fd': Permission denied
/usr/bin/find: '/proc/12/task/23/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/23/ns': Permission denied
/usr/bin/find: '/proc/12/fd': Permission denied
/usr/bin/find: '/proc/12/map_files': Permission denied
/usr/bin/find: '/proc/12/fdinfo': Permission denied
/usr/bin/find: '/proc/12/ns': Permission denied
/usr/bin/find: '/proc/12/task/12/fd': Permission denied
/usr/bin/find: '/proc/12/task/12/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/12/ns': Permission denied
/usr/bin/find: '/proc/12/task/13/fd': Permission denied
/usr/bin/find: '/proc/12/task/13/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/13/ns': Permission denied
/usr/bin/find: '/proc/12/task/14/fd': Permission denied
/usr/bin/find: '/proc/12/task/14/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/14/ns': Permission denied
/usr/bin/find: '/proc/12/task/15/fd': Permission denied
/usr/bin/find: '/proc/12/task/15/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/15/ns': Permission denied
/usr/bin/find: '/proc/12/task/16/fd': Permission denied
/usr/bin/find: '/proc/12/task/16/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/16/ns': Permission denied
/usr/bin/find: '/proc/12/task/17/fd': Permission denied
/usr/bin/find: '/proc/12/task/17/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/17/ns': Permission denied
/usr/bin/find: '/proc/12/task/18/fd': Permission denied
/usr/bin/find: '/proc/12/task/18/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/18/ns': Permission denied
/usr/bin/find: '/proc/12/task/19/fd': Permission denied
/usr/bin/find: '/proc/12/task/19/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/19/ns': Permission denied
/usr/bin/find: '/proc/12/task/20/fd': Permission denied
/usr/bin/find: '/proc/12/task/20/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/20/ns': Permission denied
/usr/bin/find: '/proc/12/task/21/fd': Permission denied
/usr/bin/find: '/proc/12/task/21/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/21/ns': Permission denied
/usr/bin/find: '/proc/12/task/22/fd': Permission denied
/usr/bin/find: '/proc/12/task/22/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/22/ns': Permission denied
/usr/bin/find: '/proc/12/task/23/fd': Permission denied
/usr/bin/find: '/proc/12/task/23/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/23/ns': Permission denied
/usr/bin/find: '/proc/12/fd': Permission denied
/usr/bin/find: '/proc/12/map_files': Permission denied
/usr/bin/find: '/proc/12/fdinfo': Permission denied
/usr/bin/find: '/proc/12/ns': Permission denied
/usr/bin/find: '/proc/12/task/12/fd': Permission denied
/usr/bin/find: '/proc/12/task/12/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/12/ns': Permission denied
/usr/bin/find: '/proc/12/task/13/fd': Permission denied
/usr/bin/find: '/proc/12/task/13/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/13/ns': Permission denied
/usr/bin/find: '/proc/12/task/14/fd': Permission denied
/usr/bin/find: '/proc/12/task/14/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/14/ns': Permission denied
/usr/bin/find: '/proc/12/task/15/fd': Permission denied
/usr/bin/find: '/proc/12/task/15/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/15/ns': Permission denied
/usr/bin/find: '/proc/12/task/16/fd': Permission denied
/usr/bin/find: '/proc/12/task/16/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/16/ns': Permission denied
/usr/bin/find: '/proc/12/task/17/fd': Permission denied
/usr/bin/find: '/proc/12/task/17/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/17/ns': Permission denied
/usr/bin/find: '/proc/12/task/18/fd': Permission denied
/usr/bin/find: '/proc/12/task/18/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/18/ns': Permission denied
/usr/bin/find: '/proc/12/task/19/fd': Permission denied
/usr/bin/find: '/proc/12/task/19/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/19/ns': Permission denied
/usr/bin/find: '/proc/12/task/20/fd': Permission denied
/usr/bin/find: '/proc/12/task/20/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/20/ns': Permission denied
/usr/bin/find: '/proc/12/task/21/fd': Permission denied
/usr/bin/find: '/proc/12/task/21/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/21/ns': Permission denied
/usr/bin/find: '/proc/12/task/22/fd': Permission denied
/usr/bin/find: '/proc/12/task/22/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/22/ns': Permission denied
/usr/bin/find: '/proc/12/task/23/fd': Permission denied
/usr/bin/find: '/proc/12/task/23/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/23/ns': Permission denied
/usr/bin/find: '/proc/12/fd': Permission denied
/usr/bin/find: '/proc/12/map_files': Permission denied
Thu Jan 23 19:35:02 UTC 2020 Capturing program information
/usr/bin/find: '/proc/12/fdinfo': Permission denied
/usr/bin/find: '/proc/12/ns': Permission denied
/usr/bin/find: '/proc/12/task/12/fd': Permission denied
Thu Jan 23 19:35:02 UTC 2020 Attempting to capture a dump with paldumper
/usr/bin/find: '/proc/12/task/12/fdinfo': Permission denied
WARNING: Capture attempt failure detected
Attempting to capture a filtered dump with paldumper
/usr/bin/find: '/proc/12/task/12/ns': Permission denied
WARNING: Attempt to capture dump failed.  Reference /var/opt/mssql/log/core.sqlservr.12.temp/log/paldumper-debug.log for details
Thu Jan 23 19:35:02 UTC 2020 Attempting to capture a dump with gdb
Thu Jan 23 19:35:02 UTC 2020 Captured a dump with gdb
/usr/bin/find: '/proc/12/task/13/fd': Permission denied
Thu Jan 23 19:35:02 UTC 2020 Capturing program binaries
Thu Jan 23 19:35:02 UTC 2020 Compressing the dump files
/usr/bin/find: '/proc/12/task/13/fdinfo': Permission denied
SQL Server 2019 will run as non-root by default.
This container is running as user mssql.
/usr/bin/find: '/proc/12/task/13/ns': Permission denied
To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216.
/usr/bin/find: '/proc/12/task/14/fd': Permission denied
/usr/bin/find: '/proc/12/task/14/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/14/ns': Permission denied
/usr/bin/find: '/proc/12/task/15/fd': Permission denied
/usr/bin/find: '/proc/12/task/15/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/15/ns': Permission denied
/usr/bin/find: '/proc/12/task/16/fd': Permission denied
/usr/bin/find: '/proc/12/task/16/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/16/ns': Permission denied

/usr/bin/find: '/proc/12/task/17/fd': Permission denied
/usr/bin/find: '/proc/12/task/17/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/17/ns': Permission denied
Ubuntu 16.04.6 LTS
/usr/bin/find: '/proc/12/task/18/fd': Permission denied
/usr/bin/find: '/proc/12/task/18/fdinfo': Permission denied
Capturing core dump and information to /var/opt/mssql/log...
/usr/bin/find: '/proc/12/task/18/ns': Permission denied
/usr/bin/find: '/proc/12/task/19/fd': Permission denied
/usr/bin/find: '/proc/12/task/19/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/19/ns': Permission denied
/usr/bin/find: '/proc/12/task/20/fd': Permission denied
/usr/bin/find: '/proc/12/task/20/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/20/ns': Permission denied
/usr/bin/find: '/proc/12/task/21/fd': Permission denied
/usr/bin/find: '/proc/12/task/21/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/21/ns': Permission denied
/usr/bin/find: '/proc/12/task/22/fd': Permission denied
/usr/bin/find: '/proc/12/task/22/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/22/ns': Permission denied
/usr/bin/find: '/proc/12/task/23/fd': Permission denied
/usr/bin/find: '/proc/12/task/23/fdinfo': Permission denied
/usr/bin/find: '/proc/12/task/23/ns': Permission denied
/usr/bin/find: '/proc/12/fd': Permission denied
/usr/bin/find: '/proc/12/map_files': Permission denied
/usr/bin/find: '/proc/12/fdinfo': Permission denied
/usr/bin/find: '/proc/12/ns': Permission denied
dmesg: read kernel buffer failed: Operation not permitted
No journal files were found.
No journal files were found.
This program has encountered a fatal error and cannot continue running at Thu Jan 23 19:39:21 2020

I've tried the steps discussed on this issue, such as this one, but none has resolved the issue. And since the issue is closed there without a proper solution, and without much support on similar issues on neither Docker nor MSSQL github issues, I am posting the question here.

like image 393
Hamed Avatar asked Jan 01 '23 08:01

Hamed


1 Answers

SOLUTION:

Adding the user: root part works for me.

Running ubuntu on host.

This is my file:

docker-compose.yml

version: "3.7"
services:
  sqlserver:
    image: mcr.microsoft.com/mssql/server:2019-latest
    container_name: sqlserver
    user: root   #####################   <<<<<<<<< IMPORTANT!!!!!  ############
    ports:
    #   host-port:container-port 
      - "1433:1433"
    environment:
      # SA_USERNAME: sa
      SA_PASSWORD: Dev1234!
      ACCEPT_EULA: Y
    volumes:
      - ./volumes/data2:/var/opt/mssql/data

has been searhing for hours

like image 87
Martin Andersen Avatar answered Jan 14 '23 01:01

Martin Andersen