如何在 openjdk docker 映像中安装 sqlcmd?

How to install sqlcmd in openjdk docker image?

我想从部署在 Azure kubernetes 上的容器连接到 Azure SQL 服务器,尤其是使用 sqlcmd。

类似的内容

如何在 openjdk docker 映像中安装 sqlcmd?我还需要在 docker 图像上安装 .Net Framework 吗?

这是我正在使用的

ARG UBUNTU_VERSION=18.04
FROM ubuntu:$UBUNTU_VERSION

ARG MSSQLTOOLS_VERSION=17.4.1.1-1
ENV PATH=/opt/mssql-tools/bin:$PATH

RUN apt-get update \
    && apt-get install -y curl apt-transport-https locales gnupg2 \
    && locale-gen "en_US.UTF-8" \
    && export `grep "VERSION_ID" /etc/os-release | sed -e 's/^VERSION_ID=\"/VERSION_ID=/' -e 's/\"$//'` \
    && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
    && curl https://packages.microsoft.com/config/ubuntu/$VERSION_ID/prod.list | tee /etc/apt/sources.list.d/msprod.list \
    && apt-get update \
    && ACCEPT_EULA=Y apt-get install -y mssql-tools=$MSSQLTOOLS_VERSION unixodbc-dev \
    && apt-get remove -y curl apt-transport-https \
    && rm -f /etc/apt/sources.list.d/msprod.list \
    && rm -rf /var/lib/apt/lists/*

## should be set after locale was generated, overwise triggers warnings
ENV LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8" LC_ALL="en_US.UTF-8"

ENTRYPOINT ["sqlcmd"]

https://github.com/fabiang/docker-sqlcmd/blob/master/Dockerfile