Skip to content

Instantly share code, notes, and snippets.

@alexhallam
Created September 18, 2019 00:06
Show Gist options
  • Save alexhallam/f8b3632d1053c739e734f96105c3af44 to your computer and use it in GitHub Desktop.
Save alexhallam/f8b3632d1053c739e734f96105c3af44 to your computer and use it in GitHub Desktop.
Rocker Docker includes odbc
FROM rocker/verse:3.6.0
# install some packages needed for odbc and MS repo
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 https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list
# install SQL Server drivers
# install SQL Server 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 r packages
RUN install2.r --error \
httr \
recipes \
rsample \
parsnip \
feather \
data.table \
janitor \
forecast \
prophet \
# Rcpp \ # should be included with tidyverse
fs \
rsample \
skimr \
log4r \
vroom \
corrr \
odbc \
tsibble \
DBI
@FreyGeospatial
Copy link

Hello- thanks for posting this dockerfile. Could you explain to me the purpose of --error on line 22?

@alexhallam
Copy link
Author

@ggpinto
Copy link

ggpinto commented Jan 31, 2022

Only to register here for future searchers: if you want to use rocker/verse:4.1.2 (latest available ATM) use the following code and don't forget to use Driver = ODBC Driver 17 for SQL Server for the odbc connection string.

FROM rocker/verse:4.1.2
# install some packages needed for odbc and MS repo
RUN apt-get update && apt-get install -y \
    curl  \
    apt-utils \
    apt-transport-https \
    debconf-utils \
    build-essential \
    unixodbc \
    && rm -rf /var/lib/apt/lists/*

# adding custom MS repository
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 
RUN curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list

# install SQL Server drivers
# install SQL Server 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"

@alexhallam
Copy link
Author

Thanks

@razielar
Copy link

@ggpinto thanks for the update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment