Mssql-docker: Docker mssql-server-linux crash when mounting a volume

Created on 28 Jul 2017  路  109Comments  路  Source: microsoft/mssql-docker

Setup:

Host-OS: Windows 10
Docker: 17.06.0-ce

Command:

docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=strong1Pass!' -e 'MSSQL_PID=Developer' --cap-add SYS_PTRACE -p 1433:1433 -v c:/users/pfliegel.sebastian/docker_vol/mssql:/var/opt/mssql -d --name mssql microsoft/mssql-server-linux:latest

Error:

This is an evaluation version. There are [165] days left in the evaluation period.This program has encountered a fatal error and cannot continue running. The following diagnostic information is available: Reason: 0x00000006 Status: 0x40000015 Message: Kernel bug check Address: 0x6a42b4a0 Parameters: 0x6a62a250 Stacktrace: 000000006a4e83c6 000000006a42b4fb 000000006a41ec9d 000000006a42ae9b 000000006a4e695d 000000006a4e599c 000000006a4e5810 000000006a4e5745 Process: 8 - sqlservr Thread: 12 (application thread 0x1000) Instance Id: 644f9aaa-60cc-444e-92cd-c2c483694108 Crash Id: e47f1b2c-f882-44ca-9a80-6b380e504d2f Build stamp: e83d0295c4b8a8055fc3842cb84be4f864e57a4bf7c38359c4427ace56a27dbf Capturing core dump and information... dmesg: read kernel buffer failed: Operation not permitted No journal files were found. No journal files were found. Attempting to capture a dump with paldumper

When I try to run the container without attaching volumes it works just fine.

Dumplog is attached: log.zip

mssql-server-linux

Most helpful comment

I've got this issue using the following run command...

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=MyStr0ngP@ssw0rd" -e "MSSQL_PID=Developer" --name "MSSQL1" -v D:\DockerMounts\MSSQL:/var/opt/mssql -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest

Host OS: Windows 10 (all up to date)
Docker version : Docker Desktop 2.1.0.5, Engine 19.03.5
SQL version: mcr.microsoft.com/mssql/server:2017-latest
File system: NTFS

Log in mounted folder shows:

This program has encountered a fatal error and cannot continue running at Wed Dec  4 15:11:58 2019
The following diagnostic information is available:

         Reason: 0x00000006
        Message: Kernel bug check
        Address: 0x6b447d60
     Parameters: 0x10861f590
    Stack Trace:
                 000000006b53539e
                 000000006b447dbb
                 000000006b43447e
                 000000006b443025
                 000000006b4431f6
                 000000006b53366c
                 000000006b5321df
                 000000006b5755d1
        Process: 8 - sqlservr
         Thread: 12 (application thread 0x4)
    Instance Id: e20894a2-8425-4e33-9cba-8d2cbbfd4f80
       Crash Id: 1daf583c-2dc9-4b8d-967f-b98b676359ca
    Build stamp: 80fb92dd4d876182c7b8d6d599e31b3f6d91efe87f8c1bb6540962021ef4b921
   Distribution: Ubuntu 16.04.6 LTS
     Processors: 2
   Total Memory: 2096136192 bytes
      Timestamp: Wed Dec  4 15:11:58 2019
     Last errno: 2
Last errno text: No such file or directory

All 109 comments

This looks a lot similar to another "Kernel bug check" in https://github.com/Microsoft/mssql-docker/issues/99

The difference is he blames NFS, I use a local Windows drive. It looks like it's an issue introduced in RC1. I'm currently trying to run the same command (different local path of course) from my private notebook (openSUSE Tumbleweed and 17.04.0-ce) and it works fine.

Will try it also with one of the CTPs.

ctp2-1 is working fine.

2 hours ago the new rc2 tag has been pushed. Same issue, though ... :(

I am having the same issue (I think).

$ docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>' -e 'MSSQL_PID=Express' --cap-add SYS_PTRACE -p 1401:1433 -v c:/data/mysql/data:/var/opt/mssql/data -d microsoft/mssql-server-linux
4aee903227eb2c5831a69e8e7d9f817710f984294810a860d9d24c070e0e5676
$ docker ps
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                                         NAMES
4aee903227eb        microsoft/mssql-server-linux   "/bin/sh -c /opt/m..."   3 seconds ago       Up 2 seconds        0.0.0.0:1401->1433/tcp                        cranky_rosalind

docker ps shows it running initially, however, after a few seconds I can run docker ps again and it is gone. Not sure where I can get any logs?

No issue when running without the volume. This is docker on windows.

Version 17.06.0-ce-win19 (12801)
Channel: stable
c98c1c2

After getting the dump the container stops, so it is correct that it is gone. You can find the logs at your mounted volume (c:/data/mysql/data).

Here is what's in my volume:

image

Not sure how to open these though.

Here is a log from docker:

$ docker-compose up
Creating network "bwcore_default" with the default driver
Creating mssql-server ...
Creating mssql-server
Attaching to mssql-server
mssql-server    | This is an evaluation version.  There are [173] days left in the evaluation period.
mssql-server    | 2017-08-03 12:44:34.57 Server      The licensing PID was successfully processed. The new edition is [Express Edition].
2017-08-03 12:44:34.80 Server      Microsoft SQL Server 2017 (RC2) - 14.0.900.75 (X64)
mssql-seJul 27 2017 08:53:49
mssql-seCopyright (C) 2017 Microsoft Corporation
mssql-seExpress Edition (64-bit) on Linux (Ubuntu 16.04.2 LTS)
2017-08-03 12:44:34.80 Server      UTC adjustment: 0:00
2017-08-03 12:44:34.80 Server      (c) Microsoft Corporation.
2017-08-03 12:44:34.80 Server      All rights reserved.
2017-08-03 12:44:34.80 Server      Server process ID is 4116.
2017-08-03 12:44:34.81 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2017-08-03 12:44:34.81 Server      Registry startup parameters:
mssql-se -d /var/opt/mssql/data/master.mdf
mssql-se -l /var/opt/mssql/data/mastlog.ldf
mssql-se -e /var/opt/mssql/log/errorlog
2017-08-03 12:44:34.82 Server      SQL Server detected 1 sockets with 2 cores per socket and 2 logical processors per socket, 2 total logical processors; using 2 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2017-08-03 12:44:34.82 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2017-08-03 12:44:34.82 Server      Detected 3143 MB of RAM. This is an informational message; no user action is required.
2017-08-03 12:44:34.83 Server      Using conventional memory in the memory manager.
2017-08-03 12:44:34.99 Server      Buffer pool extension is already disabled. No action is necessary.
2017-08-03 12:44:35.08 Server      InitializeExternalUserGroupSid failed. Implied authentication will be disabled.
2017-08-03 12:44:35.09 Server      Implied authentication manager initialization failed. Implied authentication will be disabled.
2017-08-03 12:44:35.10 Server      Successfully initialized the TLS configuration. Allowed TLS protocol versions are ['1.0 1.1 1.2']. Allowed TLS ciphers are ['ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!DHE-RSA-AES256-GCM-SHA384:!DHE-RSA-AES128-GCM-SHA256:!DHE-RSA-AES256-SHA:!DHE-RSA-AES128-SHA'].
2017-08-03 12:44:35.13 Server      The maximum number of dedicated administrator connections for this instance is '1'
2017-08-03 12:44:35.13 Server      Node configuration: node 0: CPU mask: 0x0000000000000003:0 Active CPU mask: 0x0000000000000003:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2017-08-03 12:44:35.14 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
2017-08-03 12:44:35.15 Server      In-Memory OLTP initialized on lowend machine.
2017-08-03 12:44:35.20 Server      Database Instant File Initialization: enabled. For security and performance considerations see the topic 'Database Instant File Initialization' in SQL Server Books Online. This is an informational message only. No user action is required.
2017-08-03 12:44:35.21 Server      Query Store settings initialized with enabled = 1,
2017-08-03 12:44:35.21 spid6s      Starting up database 'master'.
2017-08-03 12:44:35.21 Server      Software Usage Metrics is disabled.
2017-08-03 12:44:35.47 spid6s      Service Master Key could not be decrypted using one of its encryptions. See sys.key_encryptions for details.
2017-08-03 12:44:35.48 spid6s      An error occurred during Service Master Key initialization. SQLErrorCode=33095, State=8, LastOsError=0.
2017-08-03 12:44:35.48 spid6s      Converting database 'master' from version 863 to the current version 869.
2017-08-03 12:44:35.48 spid6s      Database 'master' running the upgrade step from version 863 to version 864.
2017-08-03 12:44:35.49 spid6s      Error: 17053, Severity: 16, State: 1.
2017-08-03 12:44:35.49 spid6s      /var/opt/mssql/data/mastlog.ldf: Operating system error 31(A device attached to the system is not functioning.) encountered.
2017-08-03 12:44:36.50 spid6s      Error: 9002, Severity: 17, State: 0.
2017-08-03 12:44:36.50 spid6s      The transaction log for database 'master' is full due to 'NOTHING'.
2017-08-03 12:44:36.51 spid6s      Error: 928, Severity: 20, State: 1.
2017-08-03 12:44:36.51 spid6s      During upgrade, database raised exception 3602, severity 25, state 53, address 0000000404CD1D8E. Use the exception number to determine the cause.
mssql-server exited with code 255

compose file:

version: '3'

services:
  mssql-server:
    image: microsoft/mssql-server-linux:latest
    container_name: mssql-server
    volumes:
      - c:/data/mssql/data:/var/opt/mssql/data
    environment:
      ACCEPT_EULA=Y
      MSSQL_PID=Express
      SA_PASSWORD=MyPassword123456
    ports:
      - "1433:1433"

You can only see the databases as you are only mounting the data volume instead of the whole mssql volume: /var/opt/mssql (not /var/opt/mssql/data).

New compose file:

version: '3'

services:
  mssql-server:
    image: microsoft/mssql-server-linux:latest
    container_name: mssql-server
    volumes:
      - c:/data/mssql:/var/opt/mssql
    environment:
      ACCEPT_EULA=Y
      MSSQL_PID=Express
      SA_PASSWORD=MyPassword123456
    ports:
      - "1433:1433"

Output from docker-compose up:

$ docker-compose up
Creating network "bwcore_default" with the default driver
Creating mssql-server ...
Creating mssql-server
Attaching to mssql-server
mssql-server    | This is an evaluation version.  There are [173] days left in the evaluation period.
mssql-server    | This program has encountered a fatal error and cannot continue running.
mssql-server    | The following diagnostic information is available:
mssql-server    |
mssql-server    |        Reason: 0x00000006
mssql-server    |        Status: 0x40000015
mssql-server    |       Message: Kernel bug check
mssql-server    |       Address: 0x6a42b4b0
mssql-server    |    Parameters: 0x6a62a250
   Stacktrace: 000000006a4e8446 000000006a42b50b 000000006a41ecad
mssql-server    |                000000006a42aeab 000000006a4e69dd 000000006a4e5a1c
mssql-server    |                000000006a4e5890 000000006a4e57c5
      Process: 7 - sqlservr
mssql-server    |        Thread: 11 (application thread 0x1000)
mssql-server    |   Instance Id: ea74a1c5-68e0-4080-bfcf-5c0225e813fa
mssql-server    |      Crash Id: 524793ab-9d77-4d48-aefe-b032583c2dd6
mssql-server    |   Build stamp: a37664e45e4156e76a53fa282fd694cb49f70c2037515f5684e3ce6dfa7549bc
mssql-server    |
mssql-server    | Capturing core dump and information...
mssql-server    | dmesg: read kernel buffer failed: Operation not permitted
mssql-server    | No journal files were found.
mssql-server    | No journal files were found.
mssql-server    | Attempting to capture a dump with paldumper
mssql-server    | WARNING: Capture attempt failure detected
mssql-server    | Attempting to capture a filtered dump with paldumper
mssql-server    | WARNING: Attempt to capture dump failed.  Reference /var/opt/mssql/log/core.sqlservr.7.temp/log/paldumper-debug.log for details
mssql-server    | Attempting to capture a dump with gdb
mssql-server    | WARNING: Unable to capture crash dump with GDB. You may need to
mssql-server    | allow ptrace debugging, enable the CAP_SYS_PTRACE capability, or
mssql-server    | run as root.
mssql-server exited with code 1

Here's a log from c:/data/mssql/log/core.sqlservr.08_03_2017_13_19_14.7.txt

This program has encountered a fatal error and cannot continue running.
The following diagnostic information is available:

       Reason: 0x00000006
       Status: 0x40000015
      Message: Kernel bug check
      Address: 0x6a42b4b0
   Parameters: 0x6a62a250






   Stacktrace: 000000006a4e8446 000000006a42b50b 000000006a41ecad 
               000000006a42aeab 000000006a4e69dd 000000006a4e5a1c 
               000000006a4e5890 000000006a4e57c5 

      Process: 7 - sqlservr
       Thread: 11 (application thread 0x1000)
  Instance Id: ea74a1c5-68e0-4080-bfcf-5c0225e813fa
     Crash Id: 524793ab-9d77-4d48-aefe-b032583c2dd6
  Build stamp: a37664e45e4156e76a53fa282fd694cb49f70c2037515f5684e3ce6dfa7549bc

Looks like the same problem.

Logs:
log.zip

In the meantime, this seems to work fine.

version: '3'

services:
  mssql-server:
    image: microsoft/mssql-server-linux:latest
    container_name: mssql-server
    volumes:
      - mssql_server_data:/var/opt/mssql/data
    environment:
      ACCEPT_EULA=Y
      MSSQL_PID=Express
      SA_PASSWORD=MyPassword123456
    ports:
      - "1433:1433"

volumes:
  mssql_server_data:

So it appears that this is only a problem when mounting the volume from the host machine.

And only on Docker for Windows 10. Works splendid on openSUSE as host system.

I have the same problem and have reverted to tag ctp2-1, which is working fine.

@benze: what host system are you running? Local mount or network share?

I have this problem as well. It used to work fine like a week ago. Since then a new Docker version was released. I have no idea what version that was though.

Currently on Docker for windows version 17.06.1-ce, build 874a737
Also tried version 17.07.0-ce build 8784753 which doesn't work either
The volume is local.
Edit: no luck with Docker version 17.06.2-ce, build cec0b72 either

I'd appreciate a fix or workaround as reverting to ctp2-1 (on which volumes currently do work) is not really a improvement for me. Recreating and seeding the databases is actually faster on rc2 than remounting on ctp2-1.

@aerkefiende: I'm running in a Win 10 box, with local mount drives. Running Docker Engine 17.06.1-ce-win24 (13025). Using Docker for Linux Containers.

Same problem encountered on Win10, Version 17.06.2-ce-win27 (13194), LinuxVM

This is a known bug. It is fixed in the RTM/GA release which will be available soon. Alternatives for now: Use :ctp2-1 or email me for a special preview image. Please only email me if this is a significant problem for you and you can't use :ctp2-1 for some reason. It takes some effort on my side to be able to set you up to pull the special preview image from our private preview registry. Email address is twright @ microsoft Sorry for the inconvenience!

now that 2017-GA is available (and the old ctp2-1 tag is deleted), this issue is resurfacing - it hasn't been fixed at all.

[INFO] DOCKER> [microsoft/mssql-server-linux:2017-GA] "Microsoft SQL Server-confluence": Start container 66f49e17402a
2017-10-03 07:58:26.07 Server      Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'.
2017-10-03 07:58:26.12 Server      Setup step is copying system data file 'C:\templatedata\mastlog.ldf' to '/var/opt/mssql/data/mastlog.ldf'.
2017-10-03 07:58:26.13 Server      Setup step is copying system data file 'C:\templatedata\model.mdf' to '/var/opt/mssql/data/model.mdf'.
2017-10-03 07:58:26.14 Server      Setup step is copying system data file 'C:\templatedata\modellog.ldf' to '/var/opt/mssql/data/modellog.ldf'.
2017-10-03 07:58:26.16 Server      Setup step is copying system data file 'C:\templatedata\msdbdata.mdf' to '/var/opt/mssql/data/msdbdata.mdf'.
2017-10-03 07:58:26.19 Server      Setup step is copying system data file 'C:\templatedata\msdblog.ldf' to '/var/opt/mssql/data/msdblog.ldf'.
2017-10-03 07:58:26.26 Server      Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64)
Aug 22 2017 17:04:49
Copyright (C) 2017 Microsoft Corporation
Developer Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS)
2017-10-03 07:58:26.26 Server      UTC adjustment: 0:00
2017-10-03 07:58:26.26 Server      (c) Microsoft Corporation.
2017-10-03 07:58:26.26 Server      All rights reserved.
2017-10-03 07:58:26.26 Server      Server process ID is 4120.
2017-10-03 07:58:26.26 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2017-10-03 07:58:26.26 Server      Registry startup parameters:
-d /var/opt/mssql/data/master.mdf
-l /var/opt/mssql/data/mastlog.ldf
-e /var/opt/mssql/log/errorlog
2017-10-03 07:58:26.27 Server      SQL Server detected 1 sockets with 2 cores per socket and 4 logical processors per socket, 4 total logical processors; using 4 logical  user action is required.
2017-10-03 07:58:26.27 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2017-10-03 07:58:26.27 Server      Detected 5984 MB of RAM. This is an informational message; no user action is required.
2017-10-03 07:58:26.27 Server      Using conventional memory in the memory manager.
2017-10-03 07:58:26.50 Server      Buffer pool extension is already disabled. No action is necessary.
2017-10-03 07:58:26.66 Server      InitializeExternalUserGroupSid failed. Implied authentication will be disabled.
2017-10-03 07:58:26.66 Server      Implied authentication manager initialization failed. Implied authentication will be disabled.
2017-10-03 07:58:26.66 Server      Successfully initialized the TLS configuration. Allowed TLS protocol versions are ['1.0 1.1 1.2']. Allowed TLS ciphers are 8-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES-RSA-AES128-GCM-SHA256:!DHE-RSA-AES256-SHA:!DHE-RSA-AES128-SHA'].
2017-10-03 07:58:26.70 Server      The maximum number of dedicated administrator connections for this instance is '1'
2017-10-03 07:58:26.70 Server      Node configuration: node 0: CPU mask: 0x000000000000000f:0 Active CPU mask: 0x000000000000000f:0. This message provides a description of the o user action is required.
2017-10-03 07:58:26.71 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message 
2017-10-03 07:58:26.71 Server      In-Memory OLTP initialized on lowend machine.
2017-10-03 07:58:26.76 Server      Database Instant File Initialization: enabled. For security and performance considerations see the topic 'Database Instant File Initialization' ion is required.
2017-10-03 07:58:26.76 Server      Query Store settings initialized with enabled = 1,
2017-10-03 07:58:26.77 spid6s      Starting up database 'master'.
2017-10-03 07:58:26.77 Server      Software Usage Metrics is disabled.
2017-10-03 07:58:26.95 spid6s      The tail of the log for database master is being rewritten to match the new sector size of 4096 bytes.  3072 bytes at offset 418816 in file /var/
2017-10-03 07:58:27.04 spid6s      Converting database 'master' from version 862 to the current version 869.
2017-10-03 07:58:27.04 spid6s      Database 'master' running the upgrade step from version 862 to version 863.
2017-10-03 07:58:27.07 spid6s      Database 'master' running the upgrade step from version 863 to version 864.
2017-10-03 07:58:27.08 spid6s      Error: 17053, Severity: 16, State: 1.
2017-10-03 07:58:27.08 spid6s      /var/opt/mssql/data/mastlog.ldf: Operating system error 31(A device attached to the system is not functioning.) encountered.
2017-10-03 07:58:28.09 spid6s      Error: 928, Severity: 20, State: 1.
2017-10-03 07:58:28.09 spid6s      During upgrade, database raised exception 9002, severity 17, state 0, address 0000000484D726DE. Use the exception number to determine the cause.
2017-10-03 07:58:28.09 spid6s      Error: 9002, Severity: 17, State: 0.
2017-10-03 07:58:28.09 spid6s      The transaction log for database 'master' is full due to 'NOTHING'.

Volume mappings are working again. I just tried both GA and latest and can confirm that the issue is fixed.

I'm running into this problem now, after being forced to upgrade to 2017-GA since the CTP2 tags are no longer hosted on docker hub. Same error as sangohan posted a few hours ago.

I found that if I explicitly mount a local directory into the /var/opt/mssql container location then the problem goes away. So it looks like I have a workaround. For those that might be wondering why I didn't already specify a mount point, it's because I use this container for automated testing so there was never a need to persist the test data once the container shutdown.

Also, the problem did not occur locally on Docker for Mac. However it was consistently happening when running on a Local SSD-backed EC2 instance.

OK, so is this issue resolved for you @jertel and @sangohan?

@twright-msft: works like a charm for me!

Now I only need the option to create a database at startup and I'm happy.

@jertel's workaround seems to work. I am still testing it out on the EC2 agents i use.

Closing the issue as noone complained so far :)

I'm actually still using the ctp-2 container I have on my machine for the next couple of weeks; I can't afford the time right now to validate that the final version works properly.

I'll post my findings as soon as I test it.

Does the final release have the same 180 day eval license restrictions, or has that changed?

The General Availability (GA) release is not timebombed. If you choose MSSQL_PID=Evaluation it will be limited to 180 days, but realistically I dont know why you would use that. If you want to just do demo, eval, testing, dev you can use MSSQL_PID=Developer (which is the default if you don't specify MSSQL_PID).

I ran into exactly the same issue when updated to the latest release a few days ago. My container loses data during restarts. Is there any way to get the fixed image or some previous tag without this issue?

I see the new tags here https://hub.docker.com/r/microsoft/mssql-server-linux/tags/ which were updated ~30 mins ago. Was this problem with "The transaction log for database 'master' is full due to 'NOTHING'." fixed there?

@benze or @twright-msft could you please share ctp-2 image? Or publish it somewhere at https://hub.docker.com ? Thanks in advance.

@Artgit I would have no issues uploading it to dockerhub, but I don't know if the MS license allows me to redistribute or republish it.

@twright-msft Would it be permissible for me to upload it to my own dockerhub account?

I need to check on the redistribution issue. For now, to be safe, I'd suggest that you push your image to a private registry and if you want to share it with others like @Artgit then you can do that by providing him docker login credentials to your private registry via a private message.

@benze please do this via private registry as @twright-msft suggested. I need this image because the latest one completely blocked my work. Thanks.

Also, @twright-msft can this image can be shared by you? I really need this one in order to unblock my work

@twright-msft I checked on the "latest" tag here https://hub.docker.com/r/microsoft/mssql-server-linux/tags/ - the issue is still there and has not been fixed :(

So, I'll be really grateful for the last working tag... it seems to be the mentioned previously "ctp-2". Thanks

@Artgit I managed to push it to my private DockerHub repo - I just need to figure out how to give you access to it; do you have a username I can add as a collaborator? Or do you have another private repo I can push it to?

@benze thank you very much ! Please try this username "inttest"

Also, today I found another repository with a fork of ctp-2. I have no issues with this one except one noisy message - "This is an evaluation version. There are [16] days left in the evaluation period." Do you have the same issue on your own version?

Yes... Although I dont think it is a noisy message. These RC releases were
supposed to be time bombed, so I suspect that it'll stop working in 16
days. In any case, I've added you as a collaborator to my private
dockerhub repo. Please let me know once you've retrieved the image.
benze/private:mssql-ctp2-1

I thought it was 180days from the day off first use, but might be fixed to
a specific calendar date instead. Perhaps @twright-msft
https://github.com/twright-msft might know more.

@benze thanks! I retrieved the image, please close access.

@twright-msft Is there any chance that Microsoft will fix their mssql-server-linux image in the next couple of days because the only 15 days remain before ctp-2-1 will stop working?

The 180 day timebomb is from the date of the build. The SQL Server instance will continue to run after the timebomb period is over, but when you try to start a new container or restart the container after the timebomb period it will not start.

@Artgit - can you please state the problem you are experiencing in detail so I can try to reproduce the problem?

@twright-msft I use the following configuration:

Windows 10 Home Edition 1709 OS Build 16299.19
Vagrant 2.0.0
VirtualBox 5.1.30 r118389 (Qt5.6.2

I use mssql-server-linux image in my integration tests via Maven + https://github.com/fabric8io/docker-maven-plugin

Everything was working fine(and works right now on ctp-2-1) before the recent releases of mssql-server-linux.

On the recent releases (including the latest one) it fails with the following error:

The transaction log for database 'master' is full due to 'NOTHING'.

I think this is some kind of mount issue... the container also loses its state(for example the previously imported data) between restarts.

I believe this topic is also related to this issue - https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ca65a3e2-2f30-4641-a7ea-d3998c8dd8a7/the-transaction-log-for-database-master-is-full-due-to-nothing-during-updade?forum=sqlsetupandupgrade&prof=required

Could you please take a look into this issue?

A few questions:
1) Where are you running Docker Engine - in a Virtual Box VM, in a Vagrant Box, or are you using Docker for Windows and running Docker Engine inside of the Moby VM on Hyper-V?

Can you please provide the complete output? There should be some additional error messages before the 'The transaction log for ...' message.

Do things work OK without docker -v volume mounting? Does the data persist a container stop/start if the data is in the container?

I use Docker inside of Virtual Box VM (Windows Docker Vagrant default - Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)).

The output:

2017-10-23 12:04:59.68 Server      Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'.
2017-10-23 12:04:59.83 Server      Setup step is copying system data file 'C:\templatedata\mastlog.ldf' to '/var/opt/mssql/data/mastlog.ldf'.
2017-10-23 12:04:59.87 Server      Setup step is copying system data file 'C:\templatedata\model.mdf' to '/var/opt/mssql/data/model.mdf'.
2017-10-23 12:04:59.92 Server      Setup step is copying system data file 'C:\templatedata\modellog.ldf' to '/var/opt/mssql/data/modellog.ldf'.
2017-10-23 12:04:59.98 Server      Setup step is copying system data file 'C:\templatedata\msdbdata.mdf' to '/var/opt/mssql/data/msdbdata.mdf'.
2017-10-23 12:05:00.03 Server      Setup step is copying system data file 'C:\templatedata\msdblog.ldf' to '/var/opt/mssql/data/msdblog.ldf'.
2017-10-23 12:05:00.21 Server      Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64)
        Aug 22 2017 17:04:49
        Copyright (C) 2017 Microsoft Corporation
        Developer Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS)
2017-10-23 12:05:00.22 Server      UTC adjustment: 0:00
2017-10-23 12:05:00.22 Server      (c) Microsoft Corporation.
2017-10-23 12:05:00.25 Server      All rights reserved.
2017-10-23 12:05:00.25 Server      Server process ID is 4116.
2017-10-23 12:05:00.26 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2017-10-23 12:05:00.27 Server      Registry startup parameters:
         -d /var/opt/mssql/data/master.mdf
         -l /var/opt/mssql/data/mastlog.ldf
         -e /var/opt/mssql/log/errorlog
2017-10-23 12:05:00.28 Server      SQL Server detected 1 sockets with 2 cores per socket and 2 logical processors per socket, 2 total logical processors; using 2 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2017-10-23 12:05:00.30 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2017-10-23 12:05:00.30 Server      Detected 3124 MB of RAM. This is an informational message; no user action is required.
2017-10-23 12:05:00.31 Server      Using conventional memory in the memory manager.
2017-10-23 12:05:00.32 Server      Warning: Timer device resolution is greater than required. Required: 1. Found: 10.
2017-10-23 12:05:00.82 Server      Buffer pool extension is already disabled. No action is necessary.
2017-10-23 12:05:01.09 Server      InitializeExternalUserGroupSid failed. Implied authentication will be disabled.
2017-10-23 12:05:01.10 Server      Implied authentication manager initialization failed. Implied authentication will be disabled.
2017-10-23 12:05:01.11 Server      Successfully initialized the TLS configuration. Allowed TLS protocol versions are ['1.0 1.1 1.2']. Allowed TLS ciphers are ['ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!DHE-RSA-AES256-GCM-SHA384:!DHE-RSA-AES128-GCM-SHA256:!DHE-RSA-AES256-SHA:!DHE-RSA-AES128-SHA'].
2017-10-23 12:05:01.17 Server      The maximum number of dedicated administrator connections for this instance is '1'
2017-10-23 12:05:01.19 Server      Node configuration: node 0: CPU mask: 0x0000000000000003:0 Active CPU mask: 0x0000000000000003:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2017-10-23 12:05:01.23 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
2017-10-23 12:05:01.24 Server      In-Memory OLTP initialized on lowend machine.
2017-10-23 12:05:01.34 Server      Database Instant File Initialization: enabled. For security and performance considerations see the topic 'Database Instant File Initialization' in SQL Server Books Online. This is an informational message only. No user action is required.
2017-10-23 12:05:01.37 Server      Query Store settings initialized with enabled = 1,
2017-10-23 12:05:01.40 spid7s      Starting up database 'master'.
2017-10-23 12:05:01.40 Server      Software Usage Metrics is disabled.
2017-10-23 12:05:01.94 spid7s      The tail of the log for database master is being rewritten to match the new sector size of 4096 bytes.  3072 bytes at offset 418816 in file /var/opt/mssql/data/mastlog.ldf will be written.
2017-10-23 12:05:02.03 spid7s      Converting database 'master' from version 862 to the current version 869.
2017-10-23 12:05:02.04 spid7s      Database 'master' running the upgrade step from version 862 to version 863.
2017-10-23 12:05:02.06 spid7s      Database 'master' running the upgrade step from version 863 to version 864.
2017-10-23 12:05:02.08 spid7s      Error: 17053, Severity: 16, State: 1.
2017-10-23 12:05:02.08 spid7s      /var/opt/mssql/data/mastlog.ldf: Operating system error 31(A device attached to the system is not functioning.) encountered.
2017-10-23 12:05:03.13 spid7s      Error: 928, Severity: 20, State: 1.
2017-10-23 12:05:03.13 spid7s      During upgrade, database raised exception 9002, severity 17, state 0, address 0000000404CD26DE. Use the exception number to determine the cause.
2017-10-23 12:05:03.18 spid7s      Error: 9002, Severity: 17, State: 0.
2017-10-23 12:05:03.18 spid7s      The transaction log for database 'master' is full due to 'NOTHING'.

There are a couple of potential problems here:
1) I think this combination of using Docker volume mounting inside of a Virtual Box VM on Windows 10 doesn't work well. This isnt the first time I've seen a problem with that.
2) We support only Ubuntu 16.04 and you are using 14.04.

Can you please try to use a vagrant 16.04 box with Docker Engine inside of it?
If that doesnt solve the problem, please try using Docker for Windows instead. That's the scenario that we test for.

Thanks for your answer.

Because of Windows 10 Home edition, I'm unable to use Hyper-V.. and thus Docker for Windows... Maybe I should consider upgrading to Windows 10 Pro...

@twright-msft We tried to upgrade Ubuntu from 14.04 to 16.04 on Vagrant VM and this approach did the trick. Now everything works fine. Thanks for your help!

Good to hear! Party on!

@twright-msft I finally upgraded by docker image and can confirm that the new image works for me too. Thanks!

It does not work form me. I'm using docker for Mac

Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: darwin/amd64

Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:45:38 2017
OS/Arch: linux/amd64
Experimental: true

Here is log

2017-11-23 08:08:30.55 Server      Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'.
2017-11-23 08:08:30.81 Server      Setup step is copying system data file 'C:\templatedata\mastlog.ldf' to '/var/opt/mssql/data/mastlog.ldf'.
2017-11-23 08:08:30.85 Server      Setup step is copying system data file 'C:\templatedata\model.mdf' to '/var/opt/mssql/data/model.mdf'.
2017-11-23 08:08:31.36 Server      Setup step is copying system data file 'C:\templatedata\modellog.ldf' to '/var/opt/mssql/data/modellog.ldf'.
2017-11-23 08:08:31.87 Server      Setup step is copying system data file 'C:\templatedata\msdbdata.mdf' to '/var/opt/mssql/data/msdbdata.mdf'.
2017-11-23 08:08:32.59 Server      Setup step is copying system data file 'C:\templatedata\msdblog.ldf' to '/var/opt/mssql/data/msdblog.ldf'.
2017-11-23 08:08:32.72 Server      Microsoft SQL Server 2017 (RTM-CU1) (KB4038634) - 14.0.3006.16 (X64)
    Oct 19 2017 02:42:29
    Copyright (C) 2017 Microsoft Corporation
    Developer Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS)
2017-11-23 08:08:32.73 Server      UTC adjustment: 0:00
2017-11-23 08:08:32.73 Server      (c) Microsoft Corporation.
2017-11-23 08:08:32.73 Server      All rights reserved.
2017-11-23 08:08:32.73 Server      Server process ID is 4116.
2017-11-23 08:08:32.73 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2017-11-23 08:08:32.74 Server      Registry startup parameters:
     -d /var/opt/mssql/data/master.mdf
     -l /var/opt/mssql/data/mastlog.ldf
     -e /var/opt/mssql/log/errorlog
2017-11-23 08:08:32.75 Server      Error: 17113, Severity: 16, State: 1.
2017-11-23 08:08:32.75 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.

@mjaric - Do you have files in your host directory at the time you are staring the container? If so, can you please try mounting to a host directory that doesnt have any files in it?

On first startup I did not, it was empty folder.

I just encountered similar problems, with this GitHub issue as nearly the only relevant search result.

My setup is a Windows 10 Pro host with VirtualBox-based Ubuntu 16.04 VM. On that VM I have docker installed, and I had a working mssql-server-linux:2017-CU2 container as part of a docker-compose file.

My setup was working a week ago. Today I ran Windows updates on the host (for Meltdown) and a backlog of Ubuntu software updates on the VM (e.g. sudo apt-get update -y). But now this command...

docker run \
  -e 'ACCEPT_EULA=Y' \
  -e 'SA_PASSWORD=yourStrong(!)Password' \
  -p 1433:1433 \
  microsoft/mssql-server-linux:2017-CU2

Will give me:

Dump collecting thread [5] hit exception [6]. Exiting.

The same thing happens when running my old docker-compose.yml file (with also Kafka and Zookeeper) or a docker-compose setup with just mssql in it. It happens both with tags 2017-CU2 and latest.

Some info about my environment:

$ uname -a
Linux Gubuntu16 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ docker --version
Docker version 17.12.0-ce, build c97c6d6

VirtualBox version on the Host: 5.1.30.

Windows 10 Pro complete with all updates.

I'm not sure what else I can do or research to fix this problem, so personally for now I'll resort to using a VM and will try to install mssql-linux on the VM directly.

This looks definitely like a different issue. No volume has been used in your scenario. Why are you running a docker instance in a VM in the first place, instead of running docker on your Windows host? How much RAM does your VM have?

@SebastianPfliegel Thank you for taking the time to respond!

The reason I'm running docker inside a VM is twofold. First, I've had stability issues and missing feature problems with Docker on Windows. Second, I use VMs for development scenarios as well and dislike Hyper-V very much for that, so I want to use VirtualBox, and because I don't want to switch hypervisors and reboot every time I want to use docker I have to run docker in my VM.

In my example there was no volume by the way, though I did try the same commands with -v sqlvolume:/var/opt/mssql as well, getting the same issue.

My VM has 2 cores from my i7 and 6 GB of RAM, so I presume it would be plenty. Like I mentioned, last week it was running just fine. (So I'm somewhat sure the cause lies in _my_ actions, e.g. the upgrades.)

You mention it looks like a different issue, so I'm tempted to open a fresh one. I do feel like I should first create a fresh repro with steps provided if possibly, I'll try to look into that later this week if I have time.

I've tried to reproduce my issue by using vagrant's ubuntu/xenial64 image. After installing docker-ce and upgrading everything the mssql container just works. This means there was something wrong with my Ubuntu VM (the docker host) specifically.

The problem in my Ubuntu VM even persisted after purging _all_ the containers and volumes and retrying.

If I started the same docker run command -it with /bin/bash and fired sql server up myself inside the container I would get only the same error:

Dump collecting thread [5] hit exception [6]. Exiting.

At my wits end I purged my docker _images_ as well and fired up docker run again, which re-downloaded the docker images .... and things worked again.

I have no clue what the actual problem was, or why purging images solved my issue, but I'm posting this (even though it's probably in the wrong place) should it some day help someone else.

@jeroenheijmans, glad for you that everything worked out!

I am having the same issue when mounting images using windows host.
Docker compose looks like below

sql1:
container_name: sql1
image: microsoft/mssql-server-linux:2017-latest
restart: always
environment:
- ACCEPT_EULA=Y
- MSSQL_SA_PASSWORD=#Passw0rd
- MSSQL_PID=Developer
ports:
- "1401:1433"
volumes:
- /d/DockerVolumes/Clarity/SQL:/var/opt/mssql
#- D:\DockerVolumesClarity\SQL:/var/opt/mssql

I am having same issue with docker for windows 1.17.12 on Hyper-V

 docker version
Client:
 Version:       17.12.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    c97c6d6
 Built: Wed Dec 27 20:05:22 2017
 OS/Arch:       windows/amd64

Server:
 Engine:
  Version:      17.12.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   c97c6d6
  Built:        Wed Dec 27 20:12:29 2017
  OS/Arch:      linux/amd64
  Experimental: true

`tion' in SQL Server Books Online. This is an informational message only. No user action is required.
2018-01-10 19:40:38.41 Server      Query Store settings initialized with enabled = 1,
2018-01-10 19:40:38.42 spid6s      Starting up database 'master'.
2018-01-10 19:40:38.45 Server      Software Usage Metrics is disabled.
2018-01-10 19:40:39.80 spid6s      The tail of the log for database master is being rewritten to match the new sector size of 4096 bytes.  3072 bytes at offset 418816 in file /var/opt/mssql/data/mastlog.ldf will be written.
2018-01-10 19:40:40.16 spid6s      Converting database 'master' from version 862 to the current version 869.
2018-01-10 19:40:40.17 spid6s      Database 'master' running the upgrade step from version 862 to version 863.
2018-01-10 19:40:40.21 spid6s      Database 'master' running the upgrade step from version 863 to version 864.
2018-01-10 19:40:40.25 spid6s      Error: 17053, Severity: 16, State: 1.
2018-01-10 19:40:40.25 spid6s      /var/opt/mssql/data/mastlog.ldf: Operating system error 31(A device attached to the system is not functioning.) encountered.
2018-01-10 19:40:41.29 spid6s      Error: 928, Severity: 20, State: 1.
2018-01-10 19:40:41.29 spid6s      During upgrade, database raised exception 9002, severity 17, state 0, address 0000000404D013DE. Use the exception number to determine the cause.
2018-01-10 19:40:41.31 spid6s      Error: 9002, Severity: 17, State: 0.
2018-01-10 19:40:41.31 spid6s      The transaction log for database 'master' is full due to 'NOTHING'.`

Exact same issue here:

2018-01-15 19:29:12.27 Server      Microsoft SQL Server 2017 (RTM-CU3-GDR) (KB4052987) - 14.0.3015.40 (X64) 
    Dec 22 2017 16:13:22 
    Copyright (C) 2017 Microsoft Corporation
    Developer Edition (64-bit) on Linux (Ubuntu 16.04.3 LTS)
2018-01-15 19:29:12.27 Server      UTC adjustment: 0:00
2018-01-15 19:29:12.27 Server      (c) Microsoft Corporation.
2018-01-15 19:29:12.27 Server      All rights reserved.
2018-01-15 19:29:12.27 Server      Server process ID is 4116.
2018-01-15 19:29:12.28 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2018-01-15 19:29:12.28 Server      Registry startup parameters: 
     -d /var/opt/mssql/data/master.mdf
     -l /var/opt/mssql/data/mastlog.ldf
     -e /var/opt/mssql/log/errorlog
2018-01-15 19:29:12.29 Server      SQL Server detected 1 sockets with 4 cores per socket and 4 logical processors per socket, 4 total logical processors; using 4 logical processors based on SQL Server licensing. This is an informational message; no user action is required.
2018-01-15 19:29:12.29 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2018-01-15 19:29:12.29 Server      Detected 1584 MB of RAM. This is an informational message; no user action is required.
2018-01-15 19:29:12.29 Server      Using conventional memory in the memory manager.
2018-01-15 19:29:14.81 Server      Buffer pool extension is already disabled. No action is necessary. 
2018-01-15 19:29:15.89 Server      InitializeExternalUserGroupSid failed. Implied authentication will be disabled.
2018-01-15 19:29:15.89 Server      Implied authentication manager initialization failed. Implied authentication will be disabled.
2018-01-15 19:29:15.89 Server      Successfully initialized the TLS configuration. Allowed TLS protocol versions are ['1.0 1.1 1.2']. Allowed TLS ciphers are ['ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:!DHE-RSA-AES256-GCM-SHA384:!DHE-RSA-AES128-GCM-SHA256:!DHE-RSA-AES256-SHA:!DHE-RSA-AES128-SHA'].
2018-01-15 19:29:15.99 Server      The maximum number of dedicated administrator connections for this instance is '1'
2018-01-15 19:29:15.99 Server      Node configuration: node 0: CPU mask: 0x000000000000000f:0 Active CPU mask: 0x000000000000000f:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
2018-01-15 19:29:16.00 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
2018-01-15 19:29:16.01 Server      In-Memory OLTP initialized on lowend machine.
2018-01-15 19:29:16.14 Server      Database Instant File Initialization: enabled. For security and performance considerations see the topic 'Database Instant File Initialization' in SQL Server Books Online. This is an informational message only. No user action is required.
2018-01-15 19:29:16.15 Server      Query Store settings initialized with enabled = 1, 
2018-01-15 19:29:16.15 spid5s      Starting up database 'master'.
2018-01-15 19:29:16.17 Server      Software Usage Metrics is disabled.
2018-01-15 19:29:16.94 spid5s      4 transactions rolled forward in database 'master' (1:0). This is an informational message only. No user action is required.
2018-01-15 19:29:16.94 spid5s      1 transactions rolled back in database 'master' (1:0). This is an informational message only. No user action is required.
2018-01-15 19:29:16.95 spid5s      Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
2018-01-15 19:29:17.02 spid5s      Converting database 'master' from version 863 to the current version 869.
2018-01-15 19:29:17.02 spid5s      Database 'master' running the upgrade step from version 863 to version 864.
2018-01-15 19:29:17.04 spid5s      Database 'master' running the upgrade step from version 864 to version 865.
2018-01-15 19:29:17.04 spid5s      Database 'master' running the upgrade step from version 865 to version 866.
2018-01-15 19:29:17.05 spid5s      Database 'master' running the upgrade step from version 866 to version 867.
2018-01-15 19:29:17.05 spid5s      Database 'master' running the upgrade step from version 867 to version 868.
2018-01-15 19:29:17.06 spid5s      Database 'master' running the upgrade step from version 868 to version 869.
2018-01-15 19:29:17.17 spid5s      Resource governor reconfiguration succeeded.
2018-01-15 19:29:17.17 spid5s      SQL Server Audit is starting the audits. This is an informational message. No user action is required.
2018-01-15 19:29:17.18 spid5s      SQL Server Audit has started the audits. This is an informational message. No user action is required.
2018-01-15 19:29:17.34 spid5s      SQL Trace ID 1 was started by login "sa".
2018-01-15 19:29:17.35 spid19s     Password policy update was successful.
2018-01-15 19:29:17.35 spid5s      Server name is 'b78f8b345fab'. This is an informational message only. No user action is required.
2018-01-15 19:29:17.36 spid21s     Always On: The availability replica manager is starting. This is an informational message only. No user action is required.
2018-01-15 19:29:17.37 spid5s      Starting up database 'msdb'.
2018-01-15 19:29:17.37 spid9s      Starting up database 'mssqlsystemresource'.
2018-01-15 19:29:17.37 spid21s     Always On: The availability replica manager is waiting for the instance of SQL Server to allow client connections. This is an informational message only. No user action is required.
2018-01-15 19:29:17.42 spid9s      The resource database build version is 14.00.3015. This is an informational message only. No user action is required.
2018-01-15 19:29:17.43 spid5s      Error: 17204, Severity: 16, State: 1.
2018-01-15 19:29:17.43 spid5s      FCB::Open failed: Could not open file d:\dbs\sh\s17o\1222_153431\cmd\21\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf for file number 1.  OS error: 2(The system cannot find the file specified.).
2018-01-15 19:29:17.43 spid5s      Error: 5120, Severity: 16, State: 101.
2018-01-15 19:29:17.43 spid5s      Unable to open the physical file "d:\dbs\sh\s17o\1222_153431\cmd\21\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf". Operating system error 2: "2(The system cannot find the file specified.)".
2018-01-15 19:29:17.45 spid9s      Starting up database 'model'.
2018-01-15 19:29:17.46 spid9s      Error: 17204, Severity: 16, State: 1.
2018-01-15 19:29:17.46 spid9s      FCB::Open failed: Could not open file d:\dbs\sh\s17o\1222_153431\cmd\21\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\model.mdf for file number 1.  OS error: 2(The system cannot find the file specified.).
2018-01-15 19:29:17.47 spid9s      Error: 5120, Severity: 16, State: 101.
2018-01-15 19:29:17.47 spid9s      Unable to open the physical file "d:\dbs\sh\s17o\1222_153431\cmd\21\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\model.mdf". Operating system error 2: "2(The system cannot find the file specified.)".
2018-01-15 19:29:17.49 spid5s      Error: 17207, Severity: 16, State: 1.
2018-01-15 19:29:17.49 spid5s      FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'd:\dbs\sh\s17o\1222_153431\cmd\21\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf'. Diagnose and correct the operating system error, and retry the operation.
2018-01-15 19:29:17.49 spid5s      File activation failure. The physical file name "d:\dbs\sh\s17o\1222_153431\cmd\21\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\MSDBLog.ldf" may be incorrect.
2018-01-15 19:29:17.51 spid9s      Error: 17207, Severity: 16, State: 1.
2018-01-15 19:29:17.51 spid9s      FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'd:\dbs\sh\s17o\1222_153431\cmd\21\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\modellog.ldf'. Diagnose and correct the operating system error, and retry the operation.
2018-01-15 19:29:17.52 spid9s      File activation failure. The physical file name "d:\dbs\sh\s17o\1222_153431\cmd\21\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\modellog.ldf" may be incorrect.
2018-01-15 19:29:17.53 spid9s      Error: 945, Severity: 14, State: 2.
2018-01-15 19:29:17.53 spid9s      Database 'model' cannot be opened due to inaccessible files or insufficient memory or disk space.  See the SQL Server errorlog for details.
2018-01-15 19:29:17.53 spid9s      SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.

@Angelinsky7 I had similar file not found errors due to what seems to be a change in the Docker engine, and where/how mounts were defined. I noticed that my old MSSQL container had stopped working after upgrading docker. I had to delete the container and relaunch a new container. In doing so, docker remapped my volume to a different mount mount, and MSSQL was now able to see my files.

Docker seems to require /host_mnt/ in its config now for drive mounts, which it didn't use before.

@benze sadly none of this seems to work for me (restarting computer, restarting docker, redownloading image, creating a new container). Today, was the first time i tried to run the container and mount it...
i run it with docker-compose :

db: image: microsoft/mssql-server-linux environment: - ACCEPT_EULA=Y - MSSQL_SA_PASSWORD=youtpasshere volumes: - ./db:/var/opt/mssql ports: - "1433:1433"

this should world correctly, no ?

It should really, but it doesn't seem to for me either :(

For anyone running this on openshift, this image runs as root, so unless you enable runasroot on your cluster, you will face the following error:

Dump collecting thread [5] hit exception [6]. Exiting.

I'm having the same issue:
/var/opt/mssql/data/mastlog.ldf: Operating system error 31(A device attached to the system is not functioning.) encountered.
The latest stable version of Docker for Windows and the latest image of SQL Server.
Problem appears only when mounting to host folder.

This seems to be an issue with Docker for Windows. Take a look at issue #241

For me it was failing while upgrading system databases and the workaround below worked for me:

I let the sql server container start first without any volume.
Once it started successfully, I copied the /var/opt/mssql/data folder using the docker cp command.
Then I started the sql server container using volume, but since this time the system databases are already upgraded, it didn't attempt to upgrade and the container started successfully!

@thesushil the workaround seems to work !!! this need a lot of test to be sure that the issue doesn't come back later and crash everything.
Plus, it's not user friendly at all !!!

@Angelinsky7 I'm glad it worked for you as well! The issue may come back if you pull a different version of sql server image, unless Microsoft fixes the issue. You will have to repeat the process to fix it again.
I know, not user friendly at all, it is just a workaround.

I guess your workaround might stop working as soon as the database files need to expand.

@thesushil work around worked for me. Dreading the next version and MS getting it wrong again :-(

Thanks @thesushil

same problem here.

@viniciusgati did the workaround work for you?

I'm having the same error starting today and I'm not even using volumes.

FROM ubuntu:16.04

# Set timezone to America/New_York
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

#Install curl since it is needed to get repo config
# Get official Microsoft repository configuration
RUN export DEBIAN_FRONTEND=noninteractive && \
    apt-get update && \
    apt-get install -y curl \
    apt-transport-https \
    p7zip-full && \
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
    curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | tee /etc/apt/sources.list.d/mssql-server.list && \
    apt-get update

# Install SQL Server which a prerequisite for the optional packages below.
RUN apt-get install -y \
    mssql-server \
    mssql-server-agent \
    mssql-server-ha \
    mssql-server-fts

# Run SQL Server process
CMD /opt/mssql/bin/sqlservr

Can everybody with this issue please report the following:

  • Host OS type (Windows, Linux incl. which distro)
  • Host OS version
  • Docker version
  • File system

Host OS type (Windows, Linux incl. which distro): macOS
Host OS version: 10.13.3 (17D47)
Docker version: 17.12.0-ce-mac49 (21995)
File system: APFS

Host OS type (Windows, Linux incl. which distro) : Windows
Host OS version: Version 10.0.16299.192]
Docker version: Docker version 17.12.0-ce, build c97c6d6
File system: NTFS

Host OS type (Windows, Linux incl. which distro) : Ubuntu 16.04 LTS
Host OS version: 4.13.0-32-generic #35~16.04.1-Ubuntu x86_64
Docker version: 17.12.0-ce, build c97c6d6
File system: ext4

Host OS type (Windows, Linux incl. which distro) : Windows
Host OS version: Version 10.0.16299.192]
Docker version: Docker version 17.12.0-ce, build c97c6d6
File system: NTFS

Host OS type (Windows, Linux incl. which distro) : Windows
Host OS version: Version 1709 OS Build 16299.248]
Docker version: Docker Version 17.12.0-ce-win47 (15139)
File system: NTFS

Host OS type (Windows, Linux incl. which distro): macOS
Host OS version: 10.13.3
Docker version: 17.12.0-ce-mac49 (21995)
File system: APFS

Host OS type (Windows, Linux incl. which distro): macOS
Host OS version: 10.13.3
Docker version: 18.03.0-ce-rc1
File system: APFS

Only way to get mssql working is "Preferences->Reset->Remove all data" and run again.
So prepare your image and push it to Docker Hub then you can use this workaround.

Host OS type (Windows, Linux incl. which distro) : Windows
Host OS version: Version 1709 OS Build 17115.rs4_release.180302_1642
Docker version: Version 18.03.0-ce-rc1-win54 (16164) Channel: edge e10c722
File system: NTFS

Running into this issue as well.

The issue originally manifested itself as the same The transaction log for database 'master' is full due to 'NOTHING'. everybody else is seeing.

Tried various solutions suggested in the thread, upgraded to :latest and downgraded to :17-CU3, but no luck.

Instead, for anybody that has more disk-space than time, the following steps let me move past the issue:

  • Mount volume as /var/opt/mssqlhost instead of /var/opt/mssql
    This will still not work 100% as your databases will fail to grow with Could not allocate a new page for database 'xxx' because of insufficient disk space in filegroup 'PRIMARY'. error
  • Copy xxx.mdf and xxx_log.ldf from /var/opt/mssqlhost to a docker mount (i.e. /var/opt/mssql)
  • Attach xxx database from /var/opt/mssql
  • Increased the initial size of xxx.mdf/ldf to whatever it needed to be at
  • Detach xxx database
  • Copy xxx.mdf and xxx_log.ldf back to /var/opt/mssqlhost (had to do this from host)
  • Attach xxx database from /var/opt/mssqlhost

This worked and my db is back online, but obviously without autogrow functionality. Would love to have a solution, but this will hold me over for a few months.

Host OS type (Windows, Linux incl. which distro): Windows
Host OS version: 10.0.16299 Build 16299
Docker version: 18.03.0-ce
File system: NTFS host (cifs when mounted)

Occurs on other mounts as already reported;

1> restore database zapmoney from disk ='/data/zapmoney.1804.bak' with move 'zapmoney' to '/data/zapmoney.mdf', move 'zapmoney_log' to '/data/zapmoney_log.ldf'
2> go
Msg 5149, Level 16, State 3, Server mssql, Line 1
MODIFY FILE encountered operating system error 31(A device attached to the system is not functioning.) while attempting to expand the physical file '/data/zapmoney.mdf'.
Msg 3013, Level 16, State 1, Server mssql, Line 1
RESTORE DATABASE is terminating abnormally.

Windows 10, v1709, 16299.309
Docker version 18.03.0-ce, build 0520e24
NTFS

Had the same problem as @staff0rd above using RESTORE DATABASE and WITH MOVE

Solved it by deleting the images and re-installing it.

Host OS type (Windows, Linux incl. which distro): Mac OS X
Host OS version: High Sierra 10.13.4
Docker version: 18.03.0-ce-mac60
File system: APFS

A fix for the SQL startup issue on Docker for Windows when /var/opt/mssql is mounted is scheduled to be released in CU7.

Specifically, this will fix the issue that shows the following in errorlog:

2018-01-10 19:40:40.17 spid6s Database 'master' running the upgrade step from version 862 to version 863.
2018-01-10 19:40:40.21 spid6s Database 'master' running the upgrade step from version 863 to version 864.
2018-01-10 19:40:40.25 spid6s Error: 17053, Severity: 16, State: 1.
2018-01-10 19:40:40.25 spid6s /var/opt/mssql/data/mastlog.ldf: Operating system error 31(A device attached to the system is not functioning.) encountered.

CU7 is the monthly cumulative update release that is scheduled to come out in the middle of next month (May).

@anikammsft @twright-msft any issue or commit links to satisfy my curiosity?

I just spent the better part of the day dealing with "Error: 17053/Operating system error 31" when trying to restore a backup on macOS High Sierra 10.13.4. I tried a bunch of solutions but in the end resizing my Docker image size from 16 GB to 32 GB fixed the issue.

I have the same problem with CU11.

Host OS: Ubuntu 18.04 with VirtualBox 5.2.18
Guest OS: Ubuntu 18.04
Docker: 17.12.1-ce

When mounting a volume pointing to a VirtualBox Shared Folder that's hosted on the host machine, SQL Server crashes, even though it's able to create a number of files before doing so.

Mounting volume pointing to a folder on the guest OS instead works, but is not a practical setup as I'd like to have minimal data on the container hosts.

I have the same issue with CU12. If I mount a volume to CIFS or NFS then SQL crashes after a few minutes. Different error though:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Cloud.Sql.Analytics.BoxTelemetry.Util.GetSqmId()
   at Microsoft.Cloud.Sql.Analytics.BoxTelemetry.MachineInfo..ctor(Util util)
   at Microsoft.Cloud.Sql.Analytics.BoxTelemetry.BoxTelemetry.TelemetryCollectorMain(BoxTelemetryOptions options)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Host OS: ESXi 6.0U3
Guest OS: Ubuntu 18.04LTS
Docker Version: 18.09.0-CE

Like some of the other comments, it creates the directory structure just fine in the persistent storage and I can even use the SQL server (until it crashes).

I've tried getting the image from Docker Hub and MCR but both have the same issue. If I remove the persistent volume, the server runs normally.

I'm having the except same issue as @MagellanTX. SQL crashes when using a mounted volume (same error msg). SQL works fine when not used with the volume.

Host OS: Win 10
Docker version: 18.09.0
SQL version: 2017-latest

I have the same issue. SQL crashes when using a mounted volume on host machine, but works fine when the volume is on the virtual machine.
Host OS: win 7 enterprise
Docker version : 18.03.0-ce
SQL version: 2017-latest-ubuntu
File system: NTFS

I have this problem too with _mcr.microsoft.com/mssql/server:2017-latest_ and _mcr.microsoft.com/mssql/server:2019-CTP3.1-ubuntu_ on Windows Server 2019 version 1809.

I cannot mount a data volume using the -v flag. docker logs give me following error:

(2017-CU11-ubuntu does not have this problem though)

This program has encountered a fatal error and cannot continue running at Tue Jul 23 17:30:19 2019
The following diagnostic information is available:

       Reason: 0x00000006
      Message: Kernel bug check
      Address: 0x6b448190
   Parameters: 0x10861f670
   Stack Trace:
               000000006b5344ce
               000000006b4481eb
               000000006b4344f6
               000000006b443622
               000000006b5327fc
               000000006b531019
               000000006b575331
        Process: 7 - sqlservr
         Thread: 11 (application thread 0x4)
    Instance Id: 43329e1c-dbf3-42a8-a284-44fbea6ae8c8
       Crash Id: 56a5abba-136b-42c7-9ab2-91dbec5b08ed
    Build stamp: 4a92842108074d858c9f7d8bbbc88360b2a93d7fe17df31bdef8b95495870f81
   Distribution: Ubuntu 16.04.6 LTS
     Processors: 3
   Total Memory: 6227410944 bytes
      Timestamp: Tue Jul 23 17:30:19 2019
     last_errno: 2
last_errno_text: No such file or directory

Ubuntu 16.04.6 LTS
Capturing core dump and information to /var/opt/mssql/log...
dmesg: read kernel buffer failed: Operation not permitted
No journal files were found.
No journal files were found.
Tue Jul 23 17:30:19 UTC 2019 Capturing program information
Tue Jul 23 17:30:20 UTC 2019 Attempting to capture a dump with paldumper
WARNING: Capture attempt failure detected
Attempting to capture a filtered dump with paldumper
WARNING: Attempt to capture dump failed.  Reference /var/opt/mssql/log/core.sqlservr.7.temp/log/paldumper-debug.log for details
Tue Jul 23 17:30:20 UTC 2019 Attempting to capture a dump with gdb
WARNING: Unable to capture crash dump with GDB. You may need to
allow ptrace debugging, enable the CAP_SYS_PTRACE capability, or
run as root.
Tue Jul 23 17:30:20 UTC 2019 Capturing program binaries
Tue Jul 23 17:30:20 UTC 2019 Compressing the dump files

Same for me, but I can use mcr.microsoft.com/mssql/server:latest but none of 2019 images.

Reported here

Hello, problem solved by upgrading our linux kernel (we applied 5.2)

Docker Toolbox on Win7 problem still occurs. My compose file:

services:
mssql1:
container_name: "mssql1"
volumes:
- ./db:/var/opt/mssql
image: "mcr.microsoft.com/mssql/server:2017-latest-ubuntu"
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: "Admin!Admin"
ports:
- "1434:1433"

     Reason: 0x00000006
    Message: Kernel bug check
    Address: 0x6c047d10
 Parameters: 0x10861f590
Stack Trace:
             000000006c1345c6
             000000006c047d6b
             000000006c03451e
             000000006c043015
             000000006c0431e6
             000000006c132938
             000000006c1314ef
             000000006c1747c1
    Process: 9 - sqlservr
     Thread: 13 (application thread 0x4)
Instance Id: 83ce0eef-5575-4d63-bd21-d52417f5ba9f
   Crash Id: 970c988e-2e1a-4cf4-88d8-1f146d1e6d86
Build stamp: fad5947c34c3f4acfa527fa10979e5c9b3c7dc2811fe1019283ffcb88e85c5c1
Distribution: Ubuntu 16.04.6 LTS
 Processors: 4

Same issue here, running docker desktop 2.1.1.0 on Windows 10 1803 when using a volume I have the following log output:

This program has encountered a fatal error and cannot continue running at Wed Sep  4 01:22:07 2019
The following diagnostic information is available:

         Reason: 0x00000006
        Message: Kernel bug check
        Address: 0x6b047d10
     Parameters: 0x10861f590
    Stack Trace:
                 000000006b1345c6
                 000000006b047d6b
                 000000006b03451e
                 000000006b043015
                 000000006b0431e6
                 000000006b132938
                 000000006b1314ef
                 000000006b1747c1
        Process: 7 - sqlservr
         Thread: 11 (application thread 0x4)
    Instance Id: d2d13881-30cb-4e05-89d3-bf9ea3f5fee4
       Crash Id: dc9088e2-e486-4aae-975b-12e9298b3744
    Build stamp: fad5947c34c3f4acfa527fa10979e5c9b3c7dc2811fe1019283ffcb88e85c5c1
   Distribution: Ubuntu 16.04.6 LTS
     Processors: 2
   Total Memory: 8329093120 bytes
      Timestamp: Wed Sep  4 01:22:07 2019
     Last errno: 2
Last errno text: No such file or directory

@M0nsieurChat - how did you update the kernel?

Same issue here, running docker desktop 2.1.0.2 on macOS 10.14.6 when using a volume I have the following log output:

The following diagnostic information is available:

         Reason: 0x00000006
        Message: Kernel bug check
        Address: 0x6ba47d10
     Parameters: 0x10861f590
    Stack Trace:
                 000000006bb345c6
                 000000006ba47d6b
                 000000006ba3451e
                 000000006ba43015
                 000000006ba431e6
                 000000006bb32938
                 000000006bb314ef
                 000000006bb747c1
        Process: 8 - sqlservr
         Thread: 12 (application thread 0x4)
    Instance Id: d9e59cb2-1d71-40cf-a198-0a75120b7c44
       Crash Id: 358267a4-191d-4ae1-a431-dc895b29a3ed
    Build stamp: fad5947c34c3f4acfa527fa10979e5c9b3c7dc2811fe1019283ffcb88e85c5c1
   Distribution: Ubuntu 16.04.6 LTS
     Processors: 6
   Total Memory: 2095681536 bytes
      Timestamp: Sun Sep 15 18:59:10 2019
     Last errno: 2
Last errno text: No such file or directory

Here my docker-compse file:

version: "3"
services:
  db:
    container_name: mssql-db-server
    image: mcr.microsoft.com/mssql/server:2017-latest-ubuntu
    ports:
      - "1433:1433"
    volumes:
      - ./data:/var/opt/mssql
    environment:
      SA_PASSWORD: "Your_password123" 
      ACCEPT_EULA: "Y"

See this:
https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-docker?view=sql-server-ver15#mount-a-host-directory-as-data-volume

Host volume mapping for Docker on Mac with the SQL Server on Linux image is not supported at this time. Use data volume containers instead. This restriction is specific to the /var/opt/mssql directory. Reading from a mounted directory works fine. For example, you can mount a host directory using -v on Mac and restore a backup from a .bak file that resides on the host.

I've got this issue using the following run command...

docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=MyStr0ngP@ssw0rd" -e "MSSQL_PID=Developer" --name "MSSQL1" -v D:\DockerMounts\MSSQL:/var/opt/mssql -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest

Host OS: Windows 10 (all up to date)
Docker version : Docker Desktop 2.1.0.5, Engine 19.03.5
SQL version: mcr.microsoft.com/mssql/server:2017-latest
File system: NTFS

Log in mounted folder shows:

This program has encountered a fatal error and cannot continue running at Wed Dec  4 15:11:58 2019
The following diagnostic information is available:

         Reason: 0x00000006
        Message: Kernel bug check
        Address: 0x6b447d60
     Parameters: 0x10861f590
    Stack Trace:
                 000000006b53539e
                 000000006b447dbb
                 000000006b43447e
                 000000006b443025
                 000000006b4431f6
                 000000006b53366c
                 000000006b5321df
                 000000006b5755d1
        Process: 8 - sqlservr
         Thread: 12 (application thread 0x4)
    Instance Id: e20894a2-8425-4e33-9cba-8d2cbbfd4f80
       Crash Id: 1daf583c-2dc9-4b8d-967f-b98b676359ca
    Build stamp: 80fb92dd4d876182c7b8d6d599e31b3f6d91efe87f8c1bb6540962021ef4b921
   Distribution: Ubuntu 16.04.6 LTS
     Processors: 2
   Total Memory: 2096136192 bytes
      Timestamp: Wed Dec  4 15:11:58 2019
     Last errno: 2
Last errno text: No such file or directory

In the meantime, this seems to work fine.

version: '3'

services:
  mssql-server:
    image: microsoft/mssql-server-linux:latest
    container_name: mssql-server
    volumes:
      - mssql_server_data:/var/opt/mssql/data
    environment:
      ACCEPT_EULA=Y
      MSSQL_PID=Express
      SA_PASSWORD=MyPassword123456
    ports:
      - "1433:1433"

volumes:
  mssql_server_data:

So it appears that this is only a problem when mounting the volume from the host machine.

What if I want to fire multiple container for multiple ms sql server? Then this code does not seem to work.

See this:
https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-docker?view=sql-server-ver15#mount-a-host-directory-as-data-volume

Host volume mapping for Docker on Mac with the SQL Server on Linux image is not supported at this time. Use data volume containers instead. This restriction is specific to the /var/opt/mssql directory. Reading from a mounted directory works fine. For example, you can mount a host directory using -v on Mac and restore a backup from a .bak file that resides on the host.

As stated in the above link:

Host volume mapping for Docker on Windows does not currently support mapping the complete /var/opt/mssql directory. However, you can map a subdirectory, such as /var/opt/mssql/data to your host machine.

    volumes:
      - D:/Server/MSSQL/data:/var/opt/mssql/data
      - D:/Server/MSSQL/log:/var/opt/mssql/log
      - D:/Server/MSSQL/secrets:/var/opt/mssql/secrets
      - D:/Server/MSSQL/backups:/var/opt/mssql/backups

This volumes work fine.

@suseu does that really work for you? I tried mounting data, log, secrets and even data directory on its own instead of whole mssql directory on my Docker for Windows, but I am still getting error. Without volumes used, this works fine, but nothing is persisted of course. So that comment on MS site seems pretty misleading unless I am doing something wrong. I even use init container in my k8s deployment to set correct owner of the data directory (command: ["sh", "-c", "chown -R 10001:0 /var/opt/mssql/data"])

SQL Server 2019 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.
2020-08-10 13:34:26.88 Server      Setup step is FORCE copying system data file 'C:\templatedata\model_replicatedmaster.mdf' to '/var/opt/mssql/data/model_replicatedmaster.mdf'.
2020-08-10 13:34:26.97 Server      Setup step is FORCE copying system data file 'C:\templatedata\model_replicatedmaster.ldf' to '/var/opt/mssql/data/model_replicatedmaster.ldf'.
2020-08-10 13:34:26.97 Server      Setup step is FORCE copying system data file 'C:\templatedata\model_msdbdata.mdf' to '/var/opt/mssql/data/model_msdbdata.mdf'.
2020-08-10 13:34:26.99 Server      Setup step is FORCE copying system data file 'C:\templatedata\model_msdblog.ldf' to '/var/opt/mssql/data/model_msdblog.ldf'.
2020-08-10 13:34:27.12 Server      Microsoft SQL Server 2019 (RTM-CU3) (KB4538853) - 15.0.4023.6 (X64)
        Mar  4 2020 00:59:26
        Copyright (C) 2019 Microsoft Corporation
        Developer Edition (64-bit) on Linux (Ubuntu 18.04.4 LTS) <X64>
2020-08-10 13:34:27.13 Server      UTC adjustment: 0:00
2020-08-10 13:34:27.13 Server      (c) Microsoft Corporation.
2020-08-10 13:34:27.13 Server      All rights reserved.
2020-08-10 13:34:27.14 Server      Server process ID is 44.
2020-08-10 13:34:27.14 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2020-08-10 13:34:27.14 Server      Registry startup parameters:
         -d /var/opt/mssql/data/master.mdf
         -l /var/opt/mssql/data/mastlog.ldf
         -e /var/opt/mssql/log/errorlog
2020-08-10 13:34:27.15 Server      Error: 17113, Severity: 16, State: 1.
2020-08-10 13:34:27.15 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.

To be fair, I just tried this using command: docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=MyStrong#Password" -p 1433:1433 -v D:/Data:/var/opt/mssql --name mssql -d mcr.microsoft.com/mssql/server:2017-latest and it works.

What does not work for me is running this in kubernetes cluster on the Docker Desktop for Windows. There I actually mount things like in template below, which I thought should work just like when I execute docker command:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mssql-database
  namespace: default
  labels:
    app: mssql
    track: canary
spec:
  serviceName: mssql-database-headless
  replicas: 1
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app: mssql
      role: master
  template:
    metadata:
      name: mssql-database
      labels:
        app: mssql
        track: canary
        role: master
    spec:
      containers:
      - name: mssql-database
        image: mcr.microsoft.com/mssql/server:2017-latest
        imagePullPolicy: IfNotPresent
        env:
        - name: ACCEPT_EULA
          value: "Y"   
        - name: SA_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mssql-db-secret
              key: password
        - name: MSSQL_PID
          value: Developer
        ports:
        - name: mssqlport
          containerPort: 1433
        volumeMounts:
        - name: mssql-database-data
          mountPath: /var/opt/mssql/data
      initContainers:
      - name: mssql-change-owner
        image: busybox:latest
        command: ["sh", "-c", "chown -R 10001:0 /var/opt/mssql/data"]
        volumeMounts:
        - name: mssql-database-data
          mountPath: /var/opt/mssql/data
      volumes:
      - name: mssql-database-data
        hostPath:
          path: /opt/virtual-clinic-mssql/data
          type: DirectoryOrCreate

No matter if I use SQL server 2017 or 2019 image. I always get error as in previous post. Only when I remove volumes, then this works fine, but without persistency in place.

In the cluster that is also hosted in the Hyper-V on windows server 2016 on multiple RedHat VMs, this template works fine as well as in Azure managed k8s cluster. So I wonder what might be the issue in my case with Docker Desktop for Windows.

In case anyone will encounter the same issue as myself, here is solution that worked for me.

I have noticed that Docker Desktop for Windows by default pushes all volumes into /var/lib/k8s-pvs/. So I set path in my volume to /var/lib/k8s-pvs/virtual-clinic-mssql/data instead of /opt/virtual-clinic-mssql/data and the template from my previous post worked fine, there is no error anymore. I also tried with /var/lib/virtual-clinic-mssql/data and it worked. I tried several other directories outside of /var/lib (e.g. /tmp or /opt), but without success. This indicates permission issues, so I will try to follow with MS folks.

I'm encountering the same issue with the following setup:
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Dev#0110" -p 1433:1433 -v "sql1volume:/var/opt/mssql/data" -d --name sql1 mcr.microsoft.com/mssql/server:2019-CU6-ubuntu-18.04
When I hit docker logs -f sql1 I get the following error:

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.
2020-08-12 03:49:54.94 Server      Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'.
2020-08-12 03:49:55.06 Server      ERROR: Setup FAILED copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf':  2(The system cannot find the file specified.)
ERROR: BootstrapSystemDataDirectories() failure (HRESULT 0x80070002)

I'm running Xubuntu 20.04 as host (kernel 5.4.0-42-generic), Docker version 19.03.12, build 48a66213fe from the official repo. Regarding the double quotes on volume: it doesn't matter if I run the command with or without them.

Funny thing is, when I run the same line on Windows, it works. However I don't know exactly what is the docker version over there, because I don't have access to the box at the moment. What I'm sure is that on Windows, I run Windows 10 2004 with Docker on WSL 2 (Ubuntu 20.04)

Using docker-compose worked for me!

version: '3'
services:
db:
user: root
image: mcr.microsoft.com/mssql/server:2019-latest
container_name: sqlserver
ports:
- 1433:1433
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=some(!)Password
volumes:
- ./volumes/data:/var/opt/mssql/data

SOLUTION:

Thanks @LeonardoHabitzreuter it works

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

Thanks, has been searhing for hours

Was this page helpful?
0 / 5 - 0 ratings