美文网首页
【Docker】常用命令记录

【Docker】常用命令记录

作者: Geekero | 来源:发表于2020-06-11 18:38 被阅读0次

    查看已有的docker镜像

    $docker images
    REPOSITORY                       TAG                 IMAGE ID            CREATED             SIZE
    aertslab/pyscenic                latest              04c50b0d9344        3 weeks ago         986MB
    desc_rstudio                     latest              08e3683cab26        6 weeks ago         12.8GB
    cellassign_rstudio_debian        latest              17077ba23c0d        8 weeks ago         6.71GB
    

    创建Docker容器

    $docker run -it -v /share/nas1/Data/Users/luohb/Pipline/BD:/home/luohb/BD -p 8887:8888 desc_rstudio /bin/bash
    
    • -it 代表开启终端模式
    • -v /share/nas1/Data/Users/luohb/Pipline/BD:/home/luohb/BD 将实际目录映射到到Docker虚拟容器的相应目录下
    • -p 8887:8888 : 宿主机端口:容器端口
    • /bin/bash 指定解析器

    删除Docker

    $docker ps -a #查看镜像和容器情况
    CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                     PORTS               NAMES
    61456c731cd4        bdgenomics/rhapsody   "/usr/bin/tini -- /b…"   58 seconds ago      Exited (0) 4 seconds ago                       heuristic_dirac
    095cf158a83e        c5d48e81b986          "/bin/bash"              8 days ago          Up 29 hours                                    test_sge_sjm
    
    $docker rm 61456c731cd4 
    61456c731cd4
    

    重新进入Docker

    $docker ps -a
    CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                      PORTS               NAMES
    9e098a2c1b11        bdgenomics/rhapsody   "/usr/bin/tini -- /b…"   23 seconds ago      Exited (0) 22 seconds ago                       confident_cannon
    521eca72fa0f        bdgenomics/rhapsody   "/usr/bin/tini -- /b…"   7 minutes ago       Up 7 minutes                                    agitated_swirles
    095cf158a83e        c5d48e81b986          "/bin/bash"              8 days ago          Up 29 hours                                     test_sge_sjm
    
    $docker start 521eca72fa0f 
    
    $docker exec -it 521eca72fa0f /bin/bash
    

    在docker内启动Jupyter Notebook且在浏览器中能被打开

    jupyter notebook --ip 0.0.0.0 --no-browser --allow-root --port 8888 &
    

    相关文章

      网友评论

          本文标题:【Docker】常用命令记录

          本文链接:https://www.haomeiwen.com/subject/bthitktx.html