microsoft / mssql-docker

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

Docker - Eval License error after installing SQL Agent using linux GA image #255

Open hartman17 opened 6 years ago

hartman17 commented 6 years ago

I've created a new docker image by using the following dockerfile:

specify the image with sql server installed

FROM microsoft/mssql-server-linux:2017-GA

accept the EULA

ENV ACCEPT_EULA=Y ENV DEBIAN_FRONTEND noninteractive

install curl & sudo

RUN apt-get update && apt-get install -y curl sudo

RUN apt-get update && apt-get install -y apt-transport-https

Import the public repository GPG keys

RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -

Register the Microsoft SQL Server Ubuntu repository

RUN curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list

update package list

RUN apt-get update -y

install the agent

RUN apt-get install -y mssql-server-agent

The image built but when I go to run it never starts:

docker run --name agent1 -e 'MSSQL_PID=Standard' -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1434:1433 -d linuxwithagent:latest

docker container logs agent1

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

   Reason: 0x00000001
   Signal: SIGSEGV - Segmentation fault (11)

Stacktrace: 000055f8f6f19ce7 00007f8cb4fac390 000055f8f6f28f52 000055f8f6f126db 000055f8f6f11e59 Process: 7 - sqlservr Thread: 24 (application thread 0x1040) Instance Id: e6b045a9-9817-4ed6-957e-8f9b974b174c Crash Id: Build stamp: a033534dbc90cff419f26ec9fbb0903dc3f3abc65769eec03f04659b9c68ebb2 Aborted

Am I adding the Agent incorrectly or missing a step?

twright-msft commented 6 years ago

There are two problems with this dockerfile.

  1. You are FROM microsoft/mssql-server-linux and then installing the mssql-server package. If you want to install the package in your build process you should start FROM ubuntu:16.04 instead of starting from an image that already has SQL Server in it. SQL Server in the mssql-server-linux image is placed in there using COPY to using the apt-get install method.

  2. You are using the old preview package repository. Please see the installation instructions for the GA package repository information. https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu GA repo: https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list

Also, see the latest version of the example Dockerfile I've provided here: https://github.com/Microsoft/mssql-docker/blob/master/linux/preview/examples/mssql-agent-fts-ha-tools/Dockerfile

hartman17 commented 6 years ago

Thank you for the information! I'm up and running now.

russellhoff commented 6 years ago

@twright-msft Thanks for your help. I've been able to create a docker image based on the Dockerfile you provide. But when I connect to the instance using SSMS I can see the Agent isn't started.

So I decided to modify the Dockerfile a little:

...
RUN apt-get install -y mssql-server-fts

# Enable Agent
CMD /opt/mssql/bin/mssql-conf set sqlagent.enabled true

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

Anyway, this doesn't work. Any hint? Thanks!!

russellhoff commented 6 years ago

It's possible to activate the agent manually: 1) Find the running docker container: sudo docker ps -a 2) Start a bash shell of the container: sudo docker exec -it a7fc0dd805bd "bash" 3) Enable the agent: root@a7fc0dd805bd:/# /opt/mssql/bin/mssql-conf set sqlagent.enabled true SQL Server needs to be restarted in order to apply this setting. Please run 'systemctl restart mssql-server.service'. root@a7fc0dd805bd:/# exit

4) Restart the container.

Voilá!

twright-msft commented 6 years ago

Instead of using mssql-conf in Dockerfile, you could try placing a mssql.conf file with the setting in it using COPY in Dockerfile. The mssql.conf file needs to go here: /var/opt/mssql/mssql.conf. It needs to contain this:

[sqlagent]
enabled = true
russellhoff commented 6 years ago

Thanks @twright-msft, I'll try it tomorrow

hitokiri commented 5 years ago

Hello I already tried this the agent console is avilita but the options to start stop and pause do not abilit