I'm trying to render a simple Rmd.
- I can render
test.Rmd
locally (Ubuntu) - But using the Dockerfile below, I get a seg fault
Steps:
- Build image below:
docker build . --tag="segfault-reprex"
- Try knit the Rmd in the container:
docker run segfault-reprex Rscript -e "rmarkdown::render('/root/test.Rmd')"
The file test.Rmd (note I've add two ' to render the knitr backticks):
---
output: pdf_document
---
```{r setup}
reticulate::virtualenv_create(
envname = "./venv",
packages = c("matplotlib")
)
venv_path = file.path(getwd(), "venv")
reticulate::use_virtualenv(venv_path, required = TRUE)
'```
```{python}
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [4, 5, 6])
'```
Dockerfile
FROM rocker/r-ver:latest
RUN apt update && apt install -y python3.8-venv python3-dev pandoc
RUN Rscript -e 'install.packages(c("reticulate", "rmarkdown"))'
COPY test.Rmd /root/