Docker - 组合包含

时间:2017-09-26 14:27:32

标签: r docker containers docker-compose

我的docker compose连接了3个容器:rstudio,selenium服务器和闪亮的服务器。我想将R库目录从rstudio容器共享到闪亮的容器,以便轻松管理R包,因为我在rstudio容器中工作。但是当我共享卷pkgspkgs2时,rstudio容器中没有包:

> list.files("/usr/local/lib/R/site-library")
[1] "backports"   "base64enc"   "bitops"      "caTools"     "digest"      "docopt"
[7] "evaluate"    "highr"       "htmltools"   "httpuv"      "jsonlite"    "knitr"
[13] "magrittr"    "markdown"    "mime"        "R6"          "Rcpp"        "rmarkdown"
[19] "rprojroot"   "shiny"       "sourcetools" "stringi"     "stringr"     "xtable"
[25] "yaml"
> list.files("/usr/local/lib/R/library")
[1] "base"         "compiler"     "datasets"     "graphics"     "grDevices"    "grid"
[7] "methods"      "parallel"     "splines"      "stats"        "stats4"       "tcltk"
[13] "tools"        "translations" "utils"

而不是(从pkgs服务中删除卷pkgs2rstudio时):

    > list.files("/usr/local/lib/R/site-library")
  [1] "acepack"                "AnnotationDbi"          "AnnotationFilter"      
  [4] "AnnotationHub"          "assertthat"             "backports"             
  [7] "base64enc"              "BH"                     "bindr"                 
 [10] "bindrcpp"               "binman"                 "Biobase"               
 [13] "BiocGenerics"           "BiocInstaller"          "BiocParallel"          
 [16] "biomaRt"                "Biostrings"             "biovizBase"            
 [19] "bit"                    "bit64"                  "bitops"                
 [22] "blob"                   "brew"                   "BSgenome"              
 [25] "caTools"                "checkmate"              "cluster"               
 [28] "codetools"              "colorspace"             "commonmark"            
 [31] "crayon"                 "curl"                   "data.table"            
 [34] "DBI"                    "DelayedArray"           "desc"                  
 [37] "devtools"               "dichromat"              "digest"                
 [40] "divosR"                 "docopt"                 "doParallel"            
 [43] "dplyr"                  "DT"                     "ensembldb"             
 [46] "EnsemblRest"            "evaluate"               "foreach"               
 [49] "foreign"                "formatR"                "Formula"               
 [52] "futile.logger"          "futile.options"         "GenomeInfoDb"          
 [55] "GenomeInfoDbData"       "GenomicAlignments"      "GenomicFeatures"       
 [58] "GenomicRanges"          "getopt"                 "ggplot2"               
 [61] "git2r"                  "GLU"                    "glue"                  
 [64] "gridBase"               "gridExtra"              "grImport"              
 [67] "gtable"                 "Gviz"                   "highr"                 
 [70] "Hmisc"                  "htmlTable"              "htmltools"             
 [73] "htmlwidgets"            "httpuv"                 "httr"                  
 [76] "igis"                   "igraph"                 "interactiveDisplayBase"
 [79] "IRanges"                "irlba"                  "iterators"             
 [82] "jsonlite"               "knitr"                  "labeling"              
 [85] "lambda.r"               "lattice"                "latticeExtra"          
 [88] "lazyeval"               "lintr"                  "littler"               
 [91] "magrittr"               "markdown"               "MASS"                  
 [94] "Matrix"                 "matrixStats"            "memoise"               
 [97] "mime"                   "miniUI"                 "mongolite"             
[100] "munsell"                "NMF"                    "nnet"                  
[103] "openssl"                "pbapply"                "pkgconfig"             
[106] "pkgmaker"               "plogr"                  "plyr"                  
[109] "png"                    "praise"                 "ProtGenerics"          
[112] "R6"                     "rappdirs"               "RColorBrewer"          
[115] "Rcpp"                   "RCurl"                  "registry"              
[118] "reshape2"               "rex"                    "rjson"                 
[121] "RJSONIO"                "rlang"                  "rmarkdown"             
[124] "RMySQL"                 "rngtools"               "roxygen2"              
[127] "rpart"                  "rprojroot"              "Rsamtools"             
[130] "RSelenium"              "RSQLite"                "rstudioapi"            
[133] "rtracklayer"            "S4Vectors"              "scales"                
[136] "semver"                 "shiny"                  "shinyjs"               
[139] "snow"                   "sourcetools"            "stringdist"            
[142] "stringi"                "stringr"                "subprocess"            
[145] "SummarizedExperiment"   "survival"               "switchr"               
[148] "testthat"               "tibble"                 "trackViewer"           
[151] "VariantAnnotation"      "viridis"                "viridisLite"           
[154] "wdman"                  "whisker"                "withr"                 
[157] "XML"                    "xml2"                   "xtable"                
[160] "XVector"                "yaml"                   "zlibbioc"              
> list.files("/usr/local/lib/R/library")
 [1] "base"         "compiler"     "datasets"     "graphics"     "grDevices"    "grid"        
 [7] "methods"      "parallel"     "splines"      "stats"        "stats4"       "tcltk"       
[13] "tools"        "translations" "utils"  

那么我做错了什么?

这是我的docker-compose-yml

version: "3"
services:
  rstudio:
    image: ropensci/rstudio
    container_name: rstudio
    environment:
      USER: "rstudio"
      PASSWORD: "rstudio"
      ROOT: "TRUE"
    ports:
      - "8787:8787"
    volumes:
      - .:/src
      - ./tmpdata/:/src/dat
      - pkgs:/usr/local/lib/R/site-library
      - pkgs2:/usr/local/lib/R/library
    links:
      - mongodb
  selenium:
    image: selenium/standalone-chrome:3.4.0-einsteinium
    container_name: selenium
    ports:
      - "4445:4444"
    links:
      - shiny:shiny
    volumes:
      - pkgs:/usr/local/lib/R/site-library
      - pkgs2:/usr/local/lib/R/library
  shiny:
    image: rocker/shiny
    ports: 
    - "3838:3838"
    container_name: shiny
    volumes:
      # app is available at http://shiny:3838/
      - ./glu/inst/shiny/:/srv/shiny-server/
      # easy access to shiny server logs
      - ./shiny.log/:/var/log/
      - ./:/src/
      - ./tmpdata:/src/dat/
      - ./:/home/shiny/
      - pkgs:/usr/local/lib/R/site-library
      - pkgs2:/usr/local/lib/R/library
volumes:
  # pkgs and pkgs2 are linked between images to share R packages
  pkgs: {}
  pkgs2: {}

0 个答案:

没有答案