microsoft / mssql-docker

Official Microsoft repository for SQL Server in Docker resources
MIT License
1.72k stars 759 forks source link

Server not starting on Linux (in a Docker container.) #195

Open HankB opened 6 years ago

HankB commented 6 years ago

OS: Ubuntu 16.04 (up to date and with MS SQL client tools installed.)

docker --version
Docker version 1.12.6, build 78d1802

Command to download and install

androidadmin@androidlx01:~$ docker run -e 'ACCEPT_EULA=Y' -e 'not my real password' \
>     -p 1433:1433 -v /dataPool/SQL-server-storage:/var/opt/mssql \
>     --restart unless-stopped \
>     -d microsoft/mssql-server-linux:2017-CU1
Unable to find image 'microsoft/mssql-server-linux:2017-CU1' locally
2017-CU1: Pulling from microsoft/mssql-server-linux
f6fa9a861b90: Pull complete 
da7318603015: Pull complete 
6a8bd10c9278: Pull complete 
d5a40291440f: Pull complete 
bbdd8a83c0f1: Pull complete 
3a52205d40a6: Pull complete 
6192691706e8: Pull complete 
1a658a9035fb: Pull complete 
fceab3b2d743: Pull complete 
8b28cf1d590c: Pull complete 
Digest: sha256:2059be15971607fdba972b0f976b5306cdd6e50718072845a37249c3bbb0fe20
Status: Downloaded newer image for microsoft/mssql-server-linux:2017-CU1
96f4d011bc861661b11c563711e3857e55471e12f3d7506791f28253cc09f76f
androidadmin@androidlx01:~$ docker ps
CONTAINER ID        IMAGE                                   COMMAND                  CREATED             STATUS                              PORTS                    NAMES
96f4d011bc86        microsoft/mssql-server-linux:2017-CU1   "/bin/sh -c /opt/mssq"   3 minutes ago       Restarting (1) About a minute ago   0.0.0.0:1433->1433/tcp   furious_boyd
286bb1fecd59        wordpress                               "docker-entrypoint.sh"   4 days ago          Up 4 days                           0.0.0.0:80->80/tcp       wordpress
a4c10a80bbc8        mariadb:10.3                            "docker-entrypoint.sh"   4 days ago          Up 4 days                           3306/tcp                 wp-mariadb
androidadmin@androidlx01:~$ 

Content of /dataPool/SQL-server-storage/log/errorlog

2017-11-06 22:05:53.15 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-06 22:05:53.15 Server      UTC adjustment: 0:00
2017-11-06 22:05:53.15 Server      (c) Microsoft Corporation.
2017-11-06 22:05:53.15 Server      All rights reserved.
2017-11-06 22:05:53.15 Server      Server process ID is 4120.
2017-11-06 22:05:53.15 Server      Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'.
2017-11-06 22:05:53.15 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-06 22:05:53.16 Server      Error: 17113, Severity: 16, State: 1.
2017-11-06 22:05:53.16 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.

The server is perpetually restarting. It is a vanilla install and I don't know what the error means or how to resolve it. Attempts to connect via 'sqlcmd' (on the host) and 'docker -it ...' are rejected because the instance is restarting.

This is an initial install pulled from https://hub.docker.com/r/microsoft/mssql-server-linux/. Not sure where to go from here.

Ballpin commented 6 years ago

I believe i found a solution for this problem. Simply add the following

 - ./.db:/var/opt/mssql/
 - /var/opt/mssql/data

This is how my docker-compose looks like.

version: '3'

services:
  db:
    image: microsoft/mssql-server-linux:2017-latest
    volumes:
      - ./.db:/var/opt/mssql/
      - /var/opt/mssql/data
    ports:
      - 8010:1433
      - 8011:1434
    environment:
      - ACCEPT_EULA=Y
      - MSSQL_SA_PASSWORD=Mysql!Server02
leeroya commented 6 years ago

The above comment worked 100% for me, Thanks @Ballpin