I found a related issue on github but it is under the msphpsql repo so I'm not sure if it applies to the driver in general for alpine. It says MS does not support yet.
Official MS installation page has installation instructions only for Debian, RedHat, SUSE, Ubuntu.
If there are any workarounds, please suggest.
If this is not possible, please elaborate your answer as technically as possible. I could not find a suitable answer for this question anywhere.
This is the Dockerfile
I've tested.
FROM alpine
# Install dependencies
RUN apk --no-cache add curl gnupg
# Download the desired package(s)
RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.6.1.1-1_amd64.apk
RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.6.1.1-1_amd64.apk
# (Optional) Verify signature, if 'gpg' is missing install it using 'apk add gnupg':
RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.6.1.1-1_amd64.sig
RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.6.1.1-1_amd64.sig
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import -
RUN gpg --verify msodbcsql17_17.6.1.1-1_amd64.sig msodbcsql17_17.6.1.1-1_amd64.apk
RUN gpg --verify mssql-tools_17.6.1.1-1_amd64.sig mssql-tools_17.6.1.1-1_amd64.apk
# Install the package(s)
RUN apk add --allow-untrusted msodbcsql17_17.6.1.1-1_amd64.apk
RUN apk add --allow-untrusted mssql-tools_17.6.1.1-1_amd64.apk
and this is the log I got,
Sending build context to Docker daemon 2.174MB
Step 1/11 : FROM alpine
---> a24bb4013296
Step 2/11 : RUN apk --no-cache add curl gnupg
---> Running in d4f7b3b86157
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/32) Installing ca-certificates (20191127-r4)
(2/32) Installing nghttp2-libs (1.41.0-r0)
(3/32) Installing libcurl (7.69.1-r0)
(4/32) Installing curl (7.69.1-r0)
(5/32) Installing libgpg-error (1.37-r0)
(6/32) Installing libassuan (2.5.3-r0)
(7/32) Installing libcap (2.27-r0)
(8/32) Installing libffi (3.3-r2)
(9/32) Installing libintl (0.20.2-r0)
(10/32) Installing libblkid (2.35.2-r0)
(11/32) Installing libmount (2.35.2-r0)
(12/32) Installing pcre (8.44-r0)
(13/32) Installing glib (2.64.4-r0)
(14/32) Installing ncurses-terminfo-base (6.2_p20200523-r0)
(15/32) Installing ncurses-libs (6.2_p20200523-r0)
(16/32) Installing libgcrypt (1.8.5-r0)
(17/32) Installing libsecret (0.20.3-r0)
(18/32) Installing pinentry (1.1.0-r2)
Executing pinentry-1.1.0-r2.post-install
(19/32) Installing libbz2 (1.0.8-r1)
(20/32) Installing gmp (6.2.0-r0)
(21/32) Installing nettle (3.5.1-r1)
(22/32) Installing p11-kit (0.23.20-r5)
(23/32) Installing libtasn1 (4.16.0-r1)
(24/32) Installing libunistring (0.9.10-r0)
(25/32) Installing gnutls (3.6.14-r0)
(26/32) Installing libksba (1.4.0-r0)
(27/32) Installing db (5.3.28-r1)
(28/32) Installing libsasl (2.1.27-r6)
(29/32) Installing libldap (2.4.50-r0)
(30/32) Installing npth (1.6-r0)
(31/32) Installing sqlite-libs (3.32.1-r0)
(32/32) Installing gnupg (2.2.20-r0)
Executing busybox-1.31.1-r16.trigger
Executing ca-certificates-20191127-r4.trigger
OK: 27 MiB in 46 packages
Removing intermediate container d4f7b3b86157
---> f874be62c59e
Step 3/11 : RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.6.1.1-1_amd64.apk
---> Running in 264bf790ce99
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 923k 100 923k 0 0 21.9M 0 --:--:-- --:--:-- --:--:-- 21.9M
Removing intermediate container 264bf790ce99
---> cb999aaac06f
Step 4/11 : RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.6.1.1-1_amd64.apk
---> Running in 7fe887056e7e
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 304k 100 304k 0 0 8236k 0 --:--:-- --:--:-- --:--:-- 8236k
Removing intermediate container 7fe887056e7e
---> 07885ffff557
Step 5/11 : RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.6.1.1-1_amd64.sig
---> Running in efb39bbe31a7
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 481 100 481 0 0 17178 0 --:--:-- --:--:-- --:--:-- 17178
Removing intermediate container efb39bbe31a7
---> 0b47b4bdc30d
Step 6/11 : RUN curl -O https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.6.1.1-1_amd64.sig
---> Running in 08a264662da9
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 481 100 481 0 0 16033 0 --:--:-- --:--:-- --:--:-- 16033
Removing intermediate container 08a264662da9
---> dad9d122c7ae
Step 7/11 : RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --import -
---> Running in ab82306e09cf
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 983 100 983 0 0 1386 0 --:--:-- --:--:-- --:--:-- 1386
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key EB3E94ADBE1229CF: public key "Microsoft (Release signing) <gpgsecurity@microsoft.com>" imported
gpg: Total number processed: 1
gpg: imported: 1
Removing intermediate container ab82306e09cf
---> 3a524358b99f
Step 8/11 : RUN gpg --verify msodbcsql17_17.6.1.1-1_amd64.sig msodbcsql17_17.6.1.1-1_amd64.apk
---> Running in 0621d8db0ef8
gpg: Signature made Tue Jul 7 21:23:47 2020 UTC
gpg: using RSA key EB3E94ADBE1229CF
gpg: Good signature from "Microsoft (Release signing) <gpgsecurity@microsoft.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
Removing intermediate container 0621d8db0ef8
---> 5e4b528817f0
Step 9/11 : RUN gpg --verify mssql-tools_17.6.1.1-1_amd64.sig mssql-tools_17.6.1.1-1_amd64.apk
---> Running in 8a51c0d21e7e
gpg: Signature made Mon Jul 6 18:59:24 2020 UTC
gpg: using RSA key EB3E94ADBE1229CF
gpg: Good signature from "Microsoft (Release signing) <gpgsecurity@microsoft.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
Removing intermediate container 8a51c0d21e7e
---> a06ecc7c2031
Step 10/11 : RUN apk add --allow-untrusted msodbcsql17_17.6.1.1-1_amd64.apk
---> Running in 8f5c10bfb5ea
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/11) Installing krb5-conf (1.0-r2)
(2/11) Installing libcom_err (1.45.6-r0)
(3/11) Installing keyutils-libs (1.6.1-r1)
(4/11) Installing libverto (0.3.1-r1)
(5/11) Installing krb5-libs (1.18.2-r0)
(6/11) Installing libgcc (9.3.0-r2)
(7/11) Installing libstdc++ (9.3.0-r2)
(8/11) Installing openssl (1.1.1g-r0)
(9/11) Installing readline (8.0.4-r0)
(10/11) Installing unixodbc (2.3.7-r2)
(11/11) Installing msodbcsql17 (17.6.1.1)
Executing msodbcsql17-17.6.1.1.pre-install
Using this product constitutes agreement with the
End User License, which can be downloaded from
https://aka.ms/odbc17eula and found in
/usr/share/doc/msodbcsql17/LICENSE.txt .
If you do not agree with the terms, please uninstall
the product by typing 'apk del msodbcsql17'
Executing msodbcsql17-17.6.1.1.post-install
Executing busybox-1.31.1-r16.trigger
OK: 186 MiB in 57 packages
Removing intermediate container 8f5c10bfb5ea
---> 3e449c097c43
Step 11/11 : RUN apk add --allow-untrusted mssql-tools_17.6.1.1-1_amd64.apk
---> Running in 889ede754d73
(1/1) Installing mssql-tools (17.6.1.1)
Executing mssql-tools-17.6.1.1.pre-install
Using this product constitutes agreement with the
End User License, which can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746949 and found in
/usr/share/doc/mssql-tools/LICENSE.txt .
If you do not agree with the terms, please uninstall
the product by typing 'apk del mssql-tools'
OK: 340 MiB in 58 packages
Removing intermediate container 889ede754d73
---> 0141e9b50f20
Successfully built 0141e9b50f20
Successfully tagged microsoft_odbc_17_alpine:latest
I hope this will solve you problem. You can find all the versions such as Alpine Linux, Debian, Red Hat Enterprise Server and Oracle Linux, SUSE Linux Enterprise Server and Ubuntu as well as you can also find Previous versions installation details from Install the Microsoft ODBC driver for SQL Server (Linux) article.