Created
January 31, 2022 10:25
-
-
Save ggpinto/b4a82a92743410357b770d7c242076b5 to your computer and use it in GitHub Desktop.
Dockerfile for rocker/tidyverse:4.1.2 with Microsoft SQL Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM rocker/tidyverse:4.1.2 | |
| # making sure that all packages will be versioned | |
| RUN R -e "options(repos = list(CRAN = 'https://mran.microsoft.com/snapshot/2022-01-30'))" | |
| # install some packages needed for odbc | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| apt-utils \ | |
| apt-transport-https \ | |
| debconf-utils \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # adding custom MS repository | |
| RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - | |
| RUN curl curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list | |
| # install SQL Server drivers and tools | |
| RUN apt-get update && ACCEPT_EULA=Y apt-get -y install msodbcsql17 mssql-tools | |
| RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc | |
| RUN /bin/bash -c "source ~/.bashrc" | |
| # install needed packages | |
| RUN R -e "install.packages('odbc')" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on this gist and this blog post. Don't forget to use
Driver = ODBC Driver 17 for SQL Serverfor the connection string.