When I try to render an rmarkdown file with a ggplot image, all the chunks work that do not contain a ggplot image and it fails without an error when it tries to run said chunk.
The output I get in my terminal is
Killed 
It runs fine on my local machine with the latest version of R and all the packages updated.
Below is the environment I am using in docker to try to run the same thing (when it fails).
R version 3.4.1 (2017-06-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Amazon Linux AMI 2017.09
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] C
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] bindrcpp_0.2.2    blogdown_0.10     rmarkdown_1.11    here_0.1         
[5] PRROC_1.3.1       DT_0.5            forcats_0.3.0     
stringr_1.3.1    
[9] dplyr_0.7.8       purrr_0.2.5       readr_1.3.1       
tidyr_0.8.2      
[13] tibble_2.0.1      ggplot2_3.1.0     tidyverse_1.2.1   
data.table_1.12.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0       lubridate_1.7.4  lattice_0.20-35  
assertthat_0.2.0
[5] rprojroot_1.3-2  digest_0.6.18    mime_0.6         R6_2.3.0        
[9] cellranger_1.1.0 plyr_1.8.4       backports_1.1.3  evaluate_0.12   
[13] httr_1.4.0       pillar_1.3.1     rlang_0.3.1      
lazyeval_0.2.1  
[17] readxl_1.2.0     rstudioapi_0.9.0 Matrix_1.2-10    
reticulate_1.10 
[21] htmlwidgets_1.3  munsell_0.5.0    shiny_1.2.0      broom_0.5.1     
[25] compiler_3.4.1   httpuv_1.4.5.1   modelr_0.1.2     xfun_0.4        
[29] pkgconfig_2.0.2  htmltools_0.3.6  tidyselect_0.2.5 crayon_1.3.4    
[33] withr_2.1.2      later_0.7.5      grid_3.4.1       nlme_3.1-131    
[37] jsonlite_1.6     xtable_1.8-3     gtable_0.2.0     magrittr_1.5    
[41] scales_1.0.0     cli_1.0.1        stringi_1.2.4     
promises_1.0.1  
[45] xml2_1.2.0       generics_0.0.2   tools_3.4.1      glue_1.3.0      
[49] hms_0.4.2        crosstalk_1.0.0  yaml_2.2.0       
colorspace_1.4-0
[53] rvest_0.3.2      knitr_1.21       bindr_0.1.1      haven_2.0.0     
