Docker (Ubuntu) + SQL Server 2022 + FTS?

huangapple go评论62阅读模式
英文:

Docker (Ubuntu)+SQL Server 2022+FTS?

问题

我正在运行 Docker(Ubuntu)+ SQL Server 2022,使用 docker-compose 文件。

version: "3.4"
services:
    sql-server-db:
        image: "mcr.microsoft.com/mssql/server:2022-latest"
        ports:
          - "52477:1433"
        environment:
            SA_PASSWORD: "dobedo#123"
            ACCEPT_EULA: "Y"

它运行正常,但是

SELECT FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')
---
0

如何在 Docker 中运行 SQL Server 2022 + FTS?

我已经创建了两个文件 docker-compose.ymlDockerfile.new(如下所述)。运行 docker-compose up -d 后,我收到以下消息:

PS D:\_Docker\SQLServer> docker-compose up -d
Building 1.1s (6/7)
[sql-server-db internal] load build definition from Dockerfile.new                                             0.0s
 transferring dockerfile: 736B                                                                               0.0s
  [sql-server-db internal] load .dockerignore                                                                    0.0s
  transferring context: 2B                                                                                    0.0s
  [sql-server-db internal] load metadata for mcr.microsoft.com/mssql/server:2022-latest                          0.0s
 [sql-server-db 1/4] FROM mcr.microsoft.com/mssql/server:2022-latest                                            0.0s
 CACHED [sql-server-db 2/4] RUN apt-get update && apt-get install -yq curl apt-transport-https                  0.0s
 ERROR [sql-server-db 3/4] RUN apt-get install -y mssql-server-fts                                              1.1s
------
 > [sql-server-db 3/4] RUN apt-get install -y mssql-server-fts:
#0 0.278 Reading package lists...
#0 0.927 Building dependency tree...
#0 1.073 Reading state information...
**#0 1.090 E: Unable to locate package mssql-server-fts**

我的 Dockerfile.new

FROM mcr.microsoft.com/mssql/server:2022-latest
USER root
RUN apt-get update && apt-get install -yq curl apt-transport-https 
#RUN add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list)"
RUN apt-get install -y mssql-server-fts
RUN apt-get update && \
    apt-get install -yq curl apt-transport-https && \
    # Get official Microsoft repository configuration
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
    curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server.list && \
    apt-get update && \
	apt-get install -y mssql-server-fts
英文:

I am running Docker (Ubuntu)+SQL Server 2022 using docker-compose file

-----
version: "3.4"
services:
    sql-server-db:
        image: "mcr.microsoft.com/mssql/server:2022-latest"
        ports:
          - "52477:1433"
        environment:
            SA_PASSWORD: "dobedo#123"
            ACCEPT_EULA: "Y"
-----

It works fine, but

SELECT FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')
---
0

How to run Docker with SQLServer2022 + FTS ?

I have created 2 files docker-compose.yml and Dockerfile.new (as it was described below). After run the >docker-compose up -d I have recived

PS D:\_Docker\SQLServer> docker-compose up -d
Building 1.1s (6/7)
[sql-server-db internal] load build definition from Dockerfile.new                                             0.0s
 transferring dockerfile: 736B                                                                               0.0s
  [sql-server-db internal] load .dockerignore                                                                    0.0s
  transferring context: 2B                                                                                    0.0s
  [sql-server-db internal] load metadata for mcr.microsoft.com/mssql/server:2022-latest                          0.0s
 [sql-server-db 1/4] FROM mcr.microsoft.com/mssql/server:2022-latest                                            0.0s
 CACHED [sql-server-db 2/4] RUN apt-get update && apt-get install -yq curl apt-transport-https                  0.0s
 ERROR [sql-server-db 3/4] RUN apt-get install -y mssql-server-fts                                              1.1s
------
 > [sql-server-db 3/4] RUN apt-get install -y mssql-server-fts:
#0 0.278 Reading package lists...
#0 0.927 Building dependency tree...
#0 1.073 Reading state information...
**#0 1.090 E: Unable to locate package mssql-server-fts**

My Dockerfile.new:

FROM mcr.microsoft.com/mssql/server:2022-latest
USER root
RUN apt-get update && apt-get install -yq curl apt-transport-https 
#RUN add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list)"
RUN apt-get install -y mssql-server-fts
RUN apt-get update && \
    apt-get install -yq curl apt-transport-https && \
    # Get official Microsoft repository configuration
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
    curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server.list && \
    apt-get update && \
	apt-get install -y mssql-server-fts

答案1

得分: 1

你应该添加包 apt install -y mssql-server-fts

所以,在你的情况下,创建一个类似这样的 Dockerfile:

FROM mcr.microsoft.com/mssql/server:2022-latest
USER root
RUN apt update && apt install -y mssql-server-fts

并相应地修改 docker-compose 文件:

services:
  sql-server-db:
    build: 
      context: .
      dockerfile: Dockerfile
    ...
英文:

You should add the package apt install -y mssql-server-fts.

So, in your case, create a Dockerfile like this:

FROM mcr.microsoft.com/mssql/server:2022-latest
USER root
RUN apt update && apt install -y mssql-server-fts

and modify the docker-compose file accordingly:

services:
  sql-server-db:
    build: 
      context: .
      dockerfile: Dockerfile
    ...

huangapple
  • 本文由 发表于 2023年6月19日 20:18:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76506555.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定