zoukankan      html  css  js  c++  java
  • docker笔记

    1、三个关键概念

    镜像(类似操作系统)、

    容器(独立环境,集装箱)、

    仓库(储存镜像)。

    2、常用命令

    a、docker info    ## 查看基本信息

    C:Users75377>docker info
    Client:
     Debug Mode: false
     Plugins:
      compose: Docker Compose (Docker Inc., v2.0.0)
      scan: Docker Scan (Docker Inc., v0.8.0)
    
    Server:
     Containers: 0
      Running: 0
      Paused: 0
      Stopped: 0
     Images: 2
     Server Version: 19.03.4
     Storage Driver: overlay2
      Backing Filesystem: extfs
      Supports d_type: true
      Native Overlay Diff: true
     Logging Driver: json-file
     Cgroup Driver: cgroupfs
     Plugins:
      Volume: local
      Network: bridge host ipvlan macvlan null overlay
      Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
     Swarm: inactive
     Runtimes: runc
     Default Runtime: runc
    ……………………

    b、docker version   ##查看版本

    C:Users75377>docker version
    Client: Docker Engine - Community
     Version:           19.03.4
     API version:       1.40
     Go version:        go1.12.10
     Git commit:        9013bf5
     Built:             Thu Oct 17 23:44:48 2019
     OS/Arch:           windows/amd64
     Experimental:      false
    
    Server: Docker Engine - Community
     Engine:
      Version:          19.03.4
      API version:      1.40 (minimum version 1.12)
      Go version:       go1.12.10
      Git commit:       9013bf5
      Built:            Thu Oct 17 23:50:38 2019
      OS/Arch:          linux/amd64
      Experimental:     false
     containerd:
      Version:          v1.2.10
      GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
     runc:
      Version:          1.0.0-rc8+dev
      GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
     docker-init:
      Version:          0.18.0
      GitCommit:        fec3683

    c、

    docker image ls     ## 查看当前的镜像

    C:Users75377>docker image ls    ## 等价于docker images
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    omicsclass/r-server     latest              9702f80127d5        8 weeks ago         9.52GB
    omicsclass/blast-plus   latest              4d81e514d744        14 months ago       2.08GB

    d、查看特定项目的所有镜像,例如组学大讲堂

    docker search omicsclass

    C:Users75377>docker search omicsclass
    NAME                                  DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
    omicsclass/rnaseq                     RNA-seq analysis docker image build by omics…   11
    omicsclass/gene-family                gene-family analysis docker image               6
    omicsclass/samtools                   samtools v1.10 build by omicsclass              3
    omicsclass/biocontainer-base          Biocontainers base Image centos7                3
    omicsclass/biolinux                   biolinux 8 image for learning linux             2
    omicsclass/ampliseq-q2                Amplicon sequencing qiime2 v2020.8 image        1
    omicsclass/isoseq3                    isoseq3 v3.3.0 build by omicsclass              1
    omicsclass/reseq                      whole genome resequence analysis                1
    omicsclass/r-server                   rstudio server and  R4.0.1 docker images        1
    omicsclass/bsaseq                     NGS Bulk Segregant Analysis image               1
    omicsclass/gsds-v2                    GSDS 2.0 – Gene Structure Display Server        1
    omicsclass/sratoolkit                 SRAtoolkit v2.10.3 and aspera v3.9.9.177872     0
    omicsclass/blastall                   legacy blastall v2.2.26                         0
    omicsclass/ampliseq-q1                Amplicon sequencing image (qiime1 v1.9.1 )      0
    omicsclass/pop-evol-gwas              population genomics evolutionary  and gwas a…   0
    omicsclass/blast-plus                 blast+ v2.9.0                                   0
    omicsclass/bwa                        BWA v0.7.17 build by omicsclass                 0
    omicsclass/eggnog                     batch gene annotation  for GO and KEGG enric…   0
    omicsclass/roll-server                rockscluster roll server  apache                0
    yuanzhengrong/omicsclass_blast-plus                                                   0

    e、如何下载镜像:  镜像官网:https://registry.hub.docker.com/

    docker pull omicsclass/samtools
    C:Users75377>docker search omicsclass
    NAME                                  DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
    omicsclass/rnaseq                     RNA-seq analysis docker image build by omics…   11
    omicsclass/gene-family                gene-family analysis docker image               6
    omicsclass/samtools                   samtools v1.10 build by omicsclass              3
    omicsclass/biocontainer-base          Biocontainers base Image centos7                3
    omicsclass/biolinux                   biolinux 8 image for learning linux             2
    omicsclass/ampliseq-q2                Amplicon sequencing qiime2 v2020.8 image        1
    omicsclass/isoseq3                    isoseq3 v3.3.0 build by omicsclass              1
    omicsclass/reseq                      whole genome resequence analysis                1
    omicsclass/r-server                   rstudio server and  R4.0.1 docker images        1
    omicsclass/bsaseq                     NGS Bulk Segregant Analysis image               1
    omicsclass/gsds-v2                    GSDS 2.0 – Gene Structure Display Server        1
    omicsclass/ampliseq-q1                Amplicon sequencing image (qiime1 v1.9.1 )      0
    omicsclass/sratoolkit                 SRAtoolkit v2.10.3 and aspera v3.9.9.177872     0
    omicsclass/blastall                   legacy blastall v2.2.26                         0
    omicsclass/pop-evol-gwas              population genomics evolutionary  and gwas a…   0
    omicsclass/blast-plus                 blast+ v2.9.0                                   0
    omicsclass/bwa                        BWA v0.7.17 build by omicsclass                 0
    omicsclass/eggnog                     batch gene annotation  for GO and KEGG enric…   0
    omicsclass/roll-server                rockscluster roll server  apache                0
    yuanzhengrong/omicsclass_blast-plus                                                   0
    
    C:Users75377>docker image ls
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    omicsclass/r-server     latest              9702f80127d5        8 weeks ago         9.52GB
    omicsclass/blast-plus   latest              4d81e514d744        14 months ago       2.08GB
    
    C:Users75377>docker pull omicsclass/samtools
    Using default tag: latest
    latest: Pulling from omicsclass/samtools
    75f829a71a1c: Already exists
    2f1aa22a89fc: Already exists
    63ddc5221a96: Already exists
    59d01c5dde5f: Already exists
    caaff27a35cb: Already exists
    b9dd84a3fbec: Already exists
    ab1e815fcac7: Already exists
    afdfc93ac601: Pull complete
    Digest: sha256:6bfe450f9e293697bbba18cb1d9166a57351266c33fe1a007c20097e71788075
    Status: Downloaded newer image for omicsclass/samtools:latest
    docker.io/omicsclass/samtools:latest
    
    C:Users75377>docker image ls
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    omicsclass/r-server     latest              9702f80127d5        8 weeks ago         9.52GB
    omicsclass/blast-plus   latest              4d81e514d744        14 months ago       2.08GB
    omicsclass/samtools     latest              03c0d88d7279        14 months ago       1.88GB

    f、如何删除镜像

    docker image rm 9702f80127d5
    C:Users75377>docker image ls
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    omicsclass/r-server     latest              9702f80127d5        8 weeks ago         9.52GB
    omicsclass/blast-plus   latest              4d81e514d744        14 months ago       2.08GB
    omicsclass/samtools     latest              03c0d88d7279        14 months ago       1.88GB
    
    C:Users75377>docker image rm 9702f80127d5    ## 这里删除上面蓝色的镜像
    Untagged: omicsclass/r-server:latest
    Untagged: omicsclass/r-server@sha256:6b0fe507035d7bae9208b1a4a03083c0d67d4e12cdcd63259b4e8f0d8499f1b1
    Deleted: sha256:9702f80127d5c2e23f6ee0654b73354f180e5dcf3ff0f133961f35bee201d91d
    Deleted: sha256:aff35628986437488413b07747e5841475be6014688302aedeb1caf817d4a1e1
    Deleted: sha256:54d05bc3d7b3eb0ac3adaa2e3b068f4e6d86bd2034d996e04c293c454e59dd60
    Deleted: sha256:814cdb34769dd5c1ad7913aa4449ec283e9f855342a087ac085b3f4aea4c2202
    Deleted: sha256:d00e2ceb77b3449d4bb5903a701711762a1e5494a899720ebae0569b5114d717
    Deleted: sha256:e7c531ae90ba0d5e4af940ef1d2d0219881182c178a49479351e1056258e889f
    Deleted: sha256:4ad9c7ed3fcd60ab373b185597f0c63512c8653596bec4996f1cb39f85f894e6
    Deleted: sha256:65d2c9f2e5ce9b7ca80dd51f72339496686d2f8e5b247e7b192a9f806a6bf375
    Deleted: sha256:2a643e7c6eb7b6926891e885338e40e873789ab03a6d337a39b65cb707d49e2b
    Deleted: sha256:e7829a46b51d62469ea247da3bab0b478ef5ce3f7612d103edbeabe19a42ff7c
    Deleted: sha256:92d211ae4181579afe1a3866c0525dfb8be7d6b10d229357e6a545ed1c317975
    Deleted: sha256:96d4ce338c68d9a5fb7f72b199801722442b4c1d0ff950c4733e7755c76d6a34
    Deleted: sha256:fc33c962e26189c7dd46747c4a2f6427aa76276227db018c7bcee0c59771d306
    Deleted: sha256:9d897aa3997501a881363663cf6051a7e3dc26c62551394856aedd2fc5ddd5bc
    Deleted: sha256:65398df90713aba11f7d3c13ee784ee3c06bfa9691623c8da5502a3098b97e59
    Deleted: sha256:57354102fc172dea56cc095792c816ec8beabfdfd29e82da5ba2ded23412d9de
    Deleted: sha256:0c732dd4afecbc40560f45eeb6c0c44db819edf1e3235b9b4113b229d347d952
    Deleted: sha256:4aaaa37ed1ad8213d9293fbd2bda80658f3b8583dfd76058f96c36fa10978fe1
    Deleted: sha256:4eb9b442995f0bcf1065874ef4731058287e2deccc14c684d522a513a86e2ffb
    Deleted: sha256:81314116a417e9fd4fe930ca4eb61164d09edff9530bace9d86b660392443e27
    Deleted: sha256:05c004fab4523fcbf000b59c72560d5e94b74c8b26c17d0756ef5999401f3798
    Deleted: sha256:28f8ea598a444eaa17d0b1a8b7122c8c233dc1fcbae13d189807b85248b0e6fe
    Deleted: sha256:67aae11461a13d711ccd01dfa30ec7189b4cdbb0541cb4db5836e89dc342a838
    Deleted: sha256:b3fb9f6b6a0cccc4643fae01ae9cee2682550029d2fe975856caaa952fa8b068
    Deleted: sha256:e4d3c0a79c9c920214394d15f619b1a04a6e1d4c5b6c7adcdb84077c0d578f78
    Deleted: sha256:7299e9a20a0d8bc0a8ac81ec07e088c0348330604f78969cfc32b9d35bdd1213
    Deleted: sha256:359262fca4e7b2c7121d7bd7503407ced09c1d83f2e12cdb055493302b9df157
    Deleted: sha256:ff0edef7b024f8977f17745b62110d1d982e9c8769992e1b34f88ba056420bea
    Deleted: sha256:174f5685490326fc0a1c0f5570b8663732189b327007e47ff13d2ca59673db02
    
    C:Users75377>docker image ls
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    omicsclass/blast-plus   latest              4d81e514d744        14 months ago       2.08GB
    omicsclass/samtools     latest              03c0d88d7279        14 months ago       1.88GB

    g、如何从镜像进入容器

    C:Users75377>docker image ls
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    omicsclass/blast-plus   latest              4d81e514d744        14 months ago       2.08GB
    omicsclass/samtools     latest              03c0d88d7279        14 months ago       1.88GB
    
    C:Users75377>docker run --rm -it omicsclass/blast-plus:latest   ## 进入上面蓝色部分的容器
    ######################################################
    #      欢迎使用组学大讲堂提供的docker镜像            #
    #      问题交流请访问:www.omicsclass.com            #
    ######################################################
    
                Linux新手建议学习课程:
          --> https://www.omicsclass.com/article/702
    
             搭建实验室生信分析平台与docker使用详情见课程:
          --> https://www.omicsclass.com/article/1181
    
               更多组学大讲堂生物信息分析课程:
          --> https://www.omicsclass.com/article/129
    [root@321507e2bad8  16:27:01 /work]# ls    ## 从此刻开始进入linux操作环境
    [root@321507e2bad8  16:27:09 /work]# echo "xxxzzz"
    xxxzzz
    [root@321507e2bad8  16:27:13 /work]#

    h、如何退出容器

    [root@321507e2bad8  16:27:13 /work]# exit
    exit

    i、如何将本机目录与容器共享

    这是windows目录:

     首次进入会询问分享确认, 同时还需要输入微软账户与密码。

    C:Users75377>docker image ls
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    omicsclass/blast-plus   latest              4d81e514d744        14 months ago       2.08GB
    omicsclass/samtools     latest              03c0d88d7279        14 months ago       1.88GB
    
    C:Users75377>docker run --rm -it -v C:Users75377Desktopaaa:/work omicsclass/blast-plus:latest   ## 共享目录
    ######################################################
    #      欢迎使用组学大讲堂提供的docker镜像            #
    #      问题交流请访问:www.omicsclass.com            #
    ######################################################
    
                Linux新手建议学习课程:
          --> https://www.omicsclass.com/article/702
    
             搭建实验室生信分析平台与docker使用详情见课程:
          --> https://www.omicsclass.com/article/1181
    
               更多组学大讲堂生物信息分析课程:
          --> https://www.omicsclass.com/article/129
    [root@a97fb6c466b8  16:37:56 /work]# ls
    [root@a97fb6c466b8  16:38:30 /work]# echo "xxxaaaa" > a.txt   ## 在容器中创建一个目录
    [root@a97fb6c466b8  16:38:40 /work]# ls
    a.txt

    在windows拖进来两个文件。

    linux查看:

     说明目录共享成功。

    j、docker ps 查看后台docker命令

    kdocker logs NAMES. 查看命令。 

    l、docker exec -it NAMES bash

  • 相关阅读:
    Unity3D鼠标点击处
    Unity3D静态AI自动寻路
    Unity3D 雷达检测器
    Unity3D重新加载光线变暗问题
    Unity3D切换场景不销毁物体
    软件&环境&网页
    2020软件工程作业05
    2020软件工程作业04
    利用Java输入输出流更改文件中指定的内容
    2020软件工程作业03
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/15517590.html
Copyright © 2011-2022 走看看