containerit can install Bioconductor packages.

First we need a Bioconductor package locally:

if (!require("BiocGenerics", character.only = TRUE)) BiocManager::install(c("BiocGenerics"))

Then we load the package in a clean session and save the session, and only then create a Dockerfile from the session to not have containerit-specific dependencies in the Dockerfile:

## INFO [2019-08-20 16:44:54] Going online? TRUE  ... to retrieve system dependencies (sysreq-api)
## INFO [2019-08-20 16:44:54] Trying to determine system requirements for the package(s) 'BiocGenerics' from sysreqs online DB
## INFO [2019-08-20 16:44:55] Adding Bioconductor packages: BiocGenerics
## INFO [2019-08-20 16:44:55] Created Dockerfile-Object based on sessionInfo

A shortcut to this is provided with the function containerit::clean_session(..):

containerit::clean_session(expr = quote(library("BiocGenerics")))

The created Dockerfile is:

FROM rocker/r-ver:3.6.1
LABEL maintainer="daniel"
RUN ["install2.r", "-r https://bioconductor.org/packages/3.9/bioc -r https://bioconductor.org/packages/3.9/data/annotation -r https://bioconductor.org/packages/3.9/data/experiment -r https://bioconductor.org/packages/3.9/workflows", "BiocGenerics"]
WORKDIR /payload/
CMD ["R"]

Using a specific Bioconductor version or installing versioned packages is not supported.