docker配置的基本操作
docker重啟以及docker容器重啟:
#docker重啟
service docker restart
#docker容器重啟/啟動(dòng)
docker restart rstudio_new
docker start rstudio_new
docker的停止以及啟動(dòng)
#停止容器:
docker stop {container}
#停止docker:
systemctl stop docker
#啟動(dòng)docker:
systemctl start docker
從宿主機(jī)到docker之間復(fù)制文件:
docker cp ./sources.list 2f46782c6b8d:/etc/apt
顯示docker container的id號(hào):
docker ps
包含已停止容器:
docker ps -a
只列出容器號(hào):
docker ps -q
進(jìn)入某個(gè)docker 容器:
docker run -it ubuntu /bin/bash渣窜;docker exec -it 69d1 /bin/bash
普通用戶身份登入docker:
docker exec -it -u WRJ rstudio_new /bin/bash
關(guān)閉與刪除:
docker stop 【容器ID】
docker rm 【容器ID】
運(yùn)行docker:
docker run --name singlecell_analysis --net=host -itd ubuntu
這里的--net要加上,不然可能運(yùn)行失敗蝠检。
rstudio-server的安裝:官網(wǎng)提供了docker的安裝鏡像港准,直接pull就行限次,完整命令:
docker run --name rstudio_new -d \
-p 8790:8787 \
-e USER=wrj_rstudio \
-e PASSWORD={password} \
-e USERID=1000 \
-e GROUPID=1000 \
-e ADD=shiny \
-v /data:/mnt/ \
rocker/rstudio
這里注意最好不要把系統(tǒng)文件直接掛載到home目錄下映挂,容易報(bào)錯(cuò)
新的docker鞭莽,rstudio配置
首先登入:
docker exec -it rstudio_new /bin/bash
之后更新:
apt-get update
apt-get upgrade
之后安裝一些系統(tǒng)包:
apt-get install -y vim
一些報(bào)錯(cuò)和解決辦法
- igraph:安裝時(shí)沒有報(bào)錯(cuò)瓮孙,load的時(shí)候報(bào)錯(cuò)唐断,libglpk.so.40: cannot open shared object file: No such file or directory
解決方法:
apt-get install -y glpk-utils libglpk-dev glpk-doc
- sf:類似問題,報(bào)錯(cuò):libudunits2.so.0: cannot open shared object file: No such file or directory
apt-get install -y libudunits2-dev
apt-get install -y libproj-dev
apt-get install -y libgdal-dev
apt-get install -y libx11-dev
apt-get install -y libmagick++-dev
apt-get install -y libharfbuzz-dev libfribidi-dev
其他安裝包:
sudo apt-get install gcc g++ liblapack-dev libblas-dev gfortran zlib1g-dev libpng-dev libxml2-dev libgsl-dev gdal-bin libgdal-dev libcairo2-dev libbz2-dev libnode-dev cmake libudunits2-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev ssh libharfbuzz-dev libfribidi-dev libfontconfig1-dev patch tcl tk
所有安裝包:
sudo apt-get install -y glpk-utils libglpk-dev glpk-doc libudunits2-dev libproj-dev libgdal-dev libx11-dev libmagick++-dev libharfbuzz-dev libfribidi-dev gcc g++ liblapack-dev libblas-dev gfortran zlib1g-dev libpng-dev libxml2-dev libgsl-dev gdal-bin libgdal-dev libcairo2-dev libbz2-dev libnode-dev cmake libudunits2-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev ssh libharfbuzz-dev libfribidi-dev libfontconfig1-dev patch tcl tk
之后手動(dòng)安裝github上的包需要預(yù)先安裝的一些R包
install.packages(c("Seurat","BiocManager","qs","assertthat", "ggrastr", "grr", "lme4", "pbmcapply", "pscl", "rsample", "RhpcBLASctl", "RcppHNSW", "spdep", "speedglm", "terra","MCMCpack", "fields", "wrMisc", "concaveman", "scatterpie", "ggcorrplot", "nnls", "RcppML", "NMF","zeallot", "imager", "raster", "magick", "shinyjs","proj4", "ash", "extrafont","ggfittext","ggpubr","intrinsicDimension", "parallelDist", "proxyC", "R.cache", "R.utils","qpdf","ggiraph"))
BiocManager::install(c("Biobase","monocle","SingleCellExperiment","batchelor","BiocParallel","DelayedArray","DelayedMatrixStats","HDF5Array","S4Vectors","SummarizedExperiment","TOAST","ComplexHeatmap","EnhancedVolcano","AnnotationDbi","clusterProfiler","glmGamPoi","RCircos"))
BiocManager::install(c("NMF","Signac","pheatmap","Deseq2","hdf5r","rhdf5","AUCell","GENIE3","networkD3","devtools","WGCNA","biomaRt","simplifyEnrichment","slingshot","ggalluvial","svglite","sna","ggnetwork","tidyverse","DESeq2","RcisTarget","amap","vcfR","sparsesvd","rsconnect","DT","ggdendro","hdf5r","shinyhelper","stringdist","ggpp",'colorRamps','factoextra','Mfuzz','org.Mm.eg.db','expm','egg','openxlsx'))
#NMF需要等Biobase安裝后才可以安裝
#Signac需要Rsamtools裝完后才可以安裝
安裝包安裝:
setwd("/mnt/R_package")
install.packages(c("monocle3-master","STUtility-master","CARD-master","ggdensity-main","ggalt-master"),type="source",repos=NULL)
install.packages(c("DoubletFinder-master","seurat-disk-master","ggunchull-main","ggdendro-main","ggpointdensity-master","ggdensity-main","SCP-main","DoubletFinder-master"),type="source",repos=NULL)
install.packages(c("CellChat-master","ggh4x-main","VoxHunt","SCENIC-master","harmony-master"),type="source",repos=NULL)
docker里面新建用戶
比較麻煩杭抠,需要自動(dòng)操作脸甘,舉例:(用戶組和用戶編號(hào)根據(jù)需求指定)
首先新建用戶組:
groupadd -g 1006 {groupname}
之后新建用戶:
useradd -u 1005 -g 1006 WRJ
(用useradd -m -u 1007 -g 1006 wrj_new的方法,就不存在后續(xù)的家目錄以及顯示問題了)
修改密碼:
passwd WRJ
建立主目錄并增加bash權(quán)限:
mkdir /home/WRJ
chown WRJ:{groupname} /home/WRJ
usermod -s /bin/bash WRJ
結(jié)果發(fā)現(xiàn)新建的用戶家目錄里沒有bashrc祈争,無法顯示文件分類顏色斤程,直接從另外一個(gè)用戶地下copy了一個(gè)過來,并更改所屬用戶:
chown username:groupname .bashrc
建議以后還是用adduser功能,可以自動(dòng)化創(chuàng)建這一系列文件忿墅。