2

I see that Alpine supports in its Docker container a MariaDB ODBC Driver as listed here. I need to install it to be used with pyodbc.

What is the Dockerfile command that installs the driver in the image?

Something along the lines of RUN apk add mariadb-connector-odbc ?

ps0604
  • 1,227
  • 23
  • 133
  • 330

1 Answers1

1

My clean install of Alpine had an /etc/apk/repositories file that looked like

#/media/cdrom/apks
http://mirror.reenigne.net/alpine/v3.13/main
#http://mirror.reenigne.net/alpine/v3.13/community
#http://mirror.reenigne.net/alpine/edge/main
#http://mirror.reenigne.net/alpine/edge/community
#http://mirror.reenigne.net/alpine/edge/testing

With that setup

apk add mariadb-connector-odbc

failed. However, after uncommenting the last line …

#/media/cdrom/apks
http://mirror.reenigne.net/alpine/v3.13/main
#http://mirror.reenigne.net/alpine/v3.13/community
#http://mirror.reenigne.net/alpine/edge/main
#http://mirror.reenigne.net/alpine/edge/community
http://mirror.reenigne.net/alpine/edge/testing

… the same command succeeded

localhost:~# apk add mariadb-connector-odbc
fetch http://mirror.reenigne.net/alpine/edge/testing/x86_64/APKINDEX.tar.gz
(1/3) Installing readline (8.1.0-r0)
(2/3) Installing unixodbc (2.3.9-r1)
(3/3) Installing mariadb-connector-odbc (3.1.11-r0)
Executing busybox-1/32/1-r6.trigger
OK: 903 MiB in 146 packages
localhost:~# ls -la /usr/lib/mariadb
total 536
drwxr-xr-x    2 root     root         4096 May 14 22:43 .
drwxr-xr-x    6 root     root         4096 May 14 22:43 ..
-rwxr-xr-x    1 root     root       537856 Jan  6 02:39 libmaodbc.so
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
  • I'm getting this, and I cannot figure out what's this dependency: `#13 0.471 fetch http://mirror.reenigne.net/alpine/edge/testing/x86_64/APKINDEX.tar.gz #13 0.909 ERROR: unsatisfiable constraints: #13 0.915 so:libodbcinst.so.2 (missing): #13 0.915 required by: mariadb-connector-odbc-3.1.11-r0[so:libodbcinst.so.2]` – ps0604 May 14 '21 at 23:25
  • `libodbcinst.so.*` is usually installed as part of unixodbc, which was included as a dependency of the `mariadb-connector-odbc` package (see `(2/3)` in the answer). You might try `apk add unixodbc` before trying to install the driver itself. (Forgive me, but I have no practical experience with Alpine Linux in the docker context. My testing is on a VirtualBox VM.) – Gord Thompson May 15 '21 at 00:22
  • 1
    This [topic](https://stackoverflow.com/questions/52899227/alpine-add-package-from-edge-repository) might also help, in order to get a specific package from the Alpine Edge repo. – M-Jack Jan 14 '22 at 14:33