美文网首页
Docker安装和使用学习

Docker安装和使用学习

作者: 晓智AI | 来源:发表于2022-04-27 20:08 被阅读0次

    安装Docker

    查看系统版本

    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 20.04.3 LTS
    Release:        20.04
    Codename:       focal
    

    官网的安装方法 https://docs.docker.com/engine/install/ubuntu/

    sudo apt-get update
    
    sudo apt-get install \
        ca-certificates \
        curl \
        gnupg \
        lsb-release
    
    sudo apt-get install \
        apt-transport-https \
        ca-certificates \
        curl \
        gnupg-agent \
        software-properties-common
    
    sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent gnupg lsb-release software-properties-common
    

    添加 docker 官方 GPG 密钥

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    

    使用下面的命令来设置稳定版本库。要添加nightly 版本库或测试版本库,请在下面的命令中的 stable 后面加上 nightly 或 test (或两者)。了解nightly和test通道。

    echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
      $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
    echo  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
    sudo add-apt-repository  "deb [arch=amd64] https://download.docker.com/linux/ubuntu    $(lsb_release -cs)   stable"
    

    安装Docker Engine

    sudo apt-get update
    
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
    
    sudo apt-get update
     
    sudo apt-get install docker-ce docker-ce-cli containerd.io
    

    验证Docker是否安装成功

    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker run hello-world
    Unable to find image 'hello-world:latest' locally
    latest: Pulling from library/hello-world
    2db29710123e: Pull complete 
    Digest: sha256:10d7d58d5ebd2a652f4d93fdd86da8f265f5318c6a73cc5b6a9798ff6d2b2e67
    Status: Downloaded newer image for hello-world:latest
    
    Hello from Docker!
    This message shows that your installation appears to be working correctly.
    
    To generate this message, Docker took the following steps:
     1. The Docker client contacted the Docker daemon.
     2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
        (amd64)
     3. The Docker daemon created a new container from that image which runs the
        executable that produces the output you are currently reading.
     4. The Docker daemon streamed that output to the Docker client, which sent it
        to your terminal.
    
    To try something more ambitious, you can run an Ubuntu container with:
     $ docker run -it ubuntu bash
    
    Share images, automate workflows, and more with a free Docker ID:
     https://hub.docker.com/
    
    For more examples and ideas, visit:
     https://docs.docker.com/get-started/
    
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ docker
    
    Usage:  docker [OPTIONS] COMMAND
    
    A self-sufficient runtime for containers
    
    Options:
          --config string      Location of client config files (default "/home/liuhz/.docker")
      -c, --context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and
                               default context set with "docker context use")
      -D, --debug              Enable debug mode
      -H, --host list          Daemon socket(s) to connect to
      -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
          --tls                Use TLS; implied by --tlsverify
          --tlscacert string   Trust certs signed only by this CA (default "/home/liuhz/.docker/ca.pem")
          --tlscert string     Path to TLS certificate file (default "/home/liuhz/.docker/cert.pem")
          --tlskey string      Path to TLS key file (default "/home/liuhz/.docker/key.pem")
          --tlsverify          Use TLS and verify the remote
      -v, --version            Print version information and quit
    
    Management Commands:
      app*        Docker App (Docker Inc., v0.9.1-beta3)
      builder     Manage builds
      buildx*     Docker Buildx (Docker Inc., v0.8.1-docker)
      compose*    Docker Compose (Docker Inc., v2.3.3)
      config      Manage Docker configs
      container   Manage containers
      context     Manage contexts
      image       Manage images
      manifest    Manage Docker image manifests and manifest lists
      network     Manage networks
      node        Manage Swarm nodes
      plugin      Manage plugins
      scan*       Docker Scan (Docker Inc., v0.17.0)
      secret      Manage Docker secrets
      service     Manage services
      stack       Manage Docker stacks
      swarm       Manage Swarm
      system      Manage Docker
      trust       Manage trust on Docker images
      volume      Manage volumes
    
    Commands:
      attach      Attach local standard input, output, and error streams to a running container
      build       Build an image from a Dockerfile
      commit      Create a new image from a container's changes
      cp          Copy files/folders between a container and the local filesystem
      create      Create a new container
      diff        Inspect changes to files or directories on a container's filesystem
      events      Get real time events from the server
      exec        Run a command in a running container
      export      Export a container's filesystem as a tar archive
      history     Show the history of an image
      images      List images
      import      Import the contents from a tarball to create a filesystem image
      info        Display system-wide information
      inspect     Return low-level information on Docker objects
      kill        Kill one or more running containers
      load        Load an image from a tar archive or STDIN
      login       Log in to a Docker registry
      logout      Log out from a Docker registry
      logs        Fetch the logs of a container
      pause       Pause all processes within one or more containers
      port        List port mappings or a specific mapping for the container
      ps          List containers
      pull        Pull an image or a repository from a registry
      push        Push an image or a repository to a registry
      rename      Rename a container
      restart     Restart one or more containers
      rm          Remove one or more containers
      rmi         Remove one or more images
      run         Run a command in a new container
      save        Save one or more images to a tar archive (streamed to STDOUT by default)
      search      Search the Docker Hub for images
      start       Start one or more stopped containers
      stats       Display a live stream of container(s) resource usage statistics
      stop        Stop one or more running containers
      tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
      top         Display the running processes of a container
      unpause     Unpause all processes within one or more containers
      update      Update configuration of one or more containers
      version     Show the Docker version information
      wait        Block until one or more containers stop, then print their exit codes
    
    Run 'docker COMMAND --help' for more information on a command.
    
    To get more help with docker, check out our guides at https://docs.docker.com/go/guides/
    
    

    查看Docker 版本

    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ docker -v
    Docker version 20.10.14, build a224086
    

    安装nvidia-docker

    https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker

    运行 NVIDIA Container Toolkit 的先决条件列表如下所述:

    1. 内核版本 > 3.10 的 GNU/Linux x86_64
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ cat /proc/version
    Linux version 5.13.0-39-generic (buildd@lcy02-amd64-080) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #44~20.04.1-Ubuntu SMP Thu Mar 24 16:43:35 UTC 2022
    
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ uname -r
    5.13.0-39-generic
    
    1. Docker >= 19.03(推荐,但某些发行版可能包含旧版本的 Docker。支持的最低版本为 1.12)
      查看Docker 版本
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ docker -v
    Docker version 20.10.14, build a224086
    
    1. 架构 >= Kepler(或计算能力 3.0)的 NVIDIA GPU

    2. NVIDIA Linux 驱动程序>= 418.81.07(请注意,不支持较旧的驱动程序版本或分支。)

    设置 Docker

    Ubuntu 上的 Docker-CE 可以使用 Docker 的官方便利脚本进行设置:

    curl https://get.docker.com | sh && sudo systemctl --now enable docker
    
    设置 NVIDIA 容器工具包

    设置包存储库和 GPG 密钥:

    distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
          && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
          && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
                sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
                sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
    

    要访问experimental功能和访问候选版本,您可能需要将experimental分支添加到存储库列表中:

    curl -s -L https://nvidia.github.io/libnvidia-container/experimental/$distribution/libnvidia-container.list | \
        sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
        sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
    

    更新包列表后安装nvidia-docker2包(和依赖项):

    sudo apt-get update
    
    sudo apt-get install -y nvidia-docker2
    

    设置默认运行时后重启 Docker 守护进程完成安装:

    sudo systemctl restart docker
    

    此时,可以通过运行基本 CUDA 容器来测试工作设置:

    sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
    
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
    Unable to find image 'nvidia/cuda:11.0-base' locally
    11.0-base: Pulling from nvidia/cuda
    54ee1f796a1e: Pull complete 
    f7bfea53ad12: Pull complete 
    46d371e02073: Pull complete 
    b66c17bbf772: Pull complete 
    3642f1a6dfb3: Pull complete 
    e5ce55b8b4b9: Pull complete 
    155bc0332b0a: Pull complete 
    Digest: sha256:774ca3d612de15213102c2dbbba55df44dc5cf9870ca2be6c6e9c627fa63d67a
    Status: Downloaded newer image for nvidia/cuda:11.0-base
    Wed Apr 27 12:49:08 2022       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 470.103.01   Driver Version: 470.103.01   CUDA Version: 11.4     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |                               |                      |               MIG M. |
    |===============================+======================+======================|
    |   0  NVIDIA GeForce ...  Off  | 00000000:18:00.0 Off |                  N/A |
    | 81%   73C    P2   334W / 350W |  23868MiB / 24268MiB |    100%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
    |   1  NVIDIA GeForce ...  Off  | 00000000:3B:00.0 Off |                  N/A |
    | 73%   70C    P2   232W / 350W |  23631MiB / 24268MiB |    100%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
    |   2  NVIDIA GeForce ...  Off  | 00000000:5E:00.0 Off |                  N/A |
    | 59%   63C    P2   262W / 350W |  22753MiB / 24268MiB |     99%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
    |   3  NVIDIA GeForce ...  Off  | 00000000:86:00.0 Off |                  N/A |
    | 59%   62C    P2   198W / 350W |  15465MiB / 24268MiB |     48%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
                                                                                   
    +-----------------------------------------------------------------------------+
    | Processes:                                                                  |
    |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
    |        ID   ID                                                   Usage      |
    |=============================================================================|
    +-----------------------------------------------------------------------------+
    
    

    下载自定义的Docker

    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker pull pytorch/pytorch:1.7.0-cuda11.0-cudnn8-devel
    [sudo] liuhz 的密码: 
    1.7.0-cuda11.0-cudnn8-devel: Pulling from pytorch/pytorch
    171857c49d0f: Already exists 
    419640447d26: Already exists 
    61e52f862619: Already exists 
    2a93278deddf: Already exists 
    c9f080049843: Already exists 
    8189556b2329: Already exists c306a0c97a55: Pull complete 
    4a9478bd0b24: Pull complete 
    19a76c31766d: Pull complete 
    1d18e0f6b7f6: Pull complete 
    d8015a90b67c: Pull complete 
    211a7eed3486: Pull complete 
    Digest: sha256:837e6964e5db6e5b35f4d5e98e9cac073ab757766039b9503f39c14beafb0e98
    Status: Downloaded newer image for pytorch/pytorch:1.7.0-cuda11.0-cudnn8-devel
    docker.io/pytorch/pytorch:1.7.0-cuda11.0-cudnn8-devel
    
    

    修改Docker路径

    创建或修改 /etc/docker/daemon.json

    {
        "runtimes": {
            "nvidia": {
                "path": "nvidia-container-runtime",
                "runtimeArgs": []
            }
        },
        "registry-mirrors": [
            "https://1nj0zren.mirror.aliyuncs.com",
            "https://docker.mirrors.ustc.edu.cn",
            "http://f1361db2.m.daocloud.io",
            "https://registry.docker-cn.com"],
        "data-root": "/home/liuhz/Docker/docker"
    }
    
    sudo systemctl daemon-reload
    sudo systemctl restart docker
    

    权限问题加入docker用户组

    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ docker images
    Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json": dial unix /var/run/docker.sock: connect: permission denied
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker images
    [sudo] liuhz 的密码: 
    REPOSITORY    TAG         IMAGE ID       CREATED         SIZE
    hello-world   latest      feb5d9fea6a5   7 months ago    13.3kB
    nvidia/cuda   11.0-base   2ec708416bb8   20 months ago   122MB
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo groupadd docker
    groupadd:“docker”组已存在
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo gpasswd -a liuhz docker
    正在将用户“liuhz”加入到“docker”组中
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ newgrp docker
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ docker ps
    CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ docker images
    REPOSITORY    TAG         IMAGE ID       CREATED         SIZE
    hello-world   latest      feb5d9fea6a5   7 months ago    13.3kB
    nvidia/cuda   11.0-base   2ec708416bb8   20 months ago   122MB
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ 
    
    

    在Docker中运行nnUNet

    在dockerhub上查询nvidia/cuda:10.2-cudnn8-devel-ubuntu18.04 ,版本号对应项目运行环境的需求

    将其拉下来,sudo docker pull nvidia/cuda:10.2-cudnn8-devel-ubuntu18.04 ,成功后会有一个容器ID

    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker pull nvidia/cuda:11.4.0-cudnn8-devel-ubuntu20.04
    
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker pull pytorch/pytorch:1.7.0-cuda11.0-cudnn8-devel
    
    

    在dockerhub上pytorch
    https://hub.docker.com/r/pytorch/pytorch/tags?page=1&ordering=last_updated

    在dockerhub上ubuntu
    https://hub.docker.com/r/nvidia/cuda/
    https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/supported-tags.md

    查看镜像和运行镜像

    查看本地库中的镜像

    sudo docker images -a
    
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~/Docker$ sudo docker images -a
    REPOSITORY    TAG                             IMAGE ID       CREATED       SIZE
    nvidia/cuda   10.2-cudnn8-devel-ubuntu18.04   0dd9ea953585   3 weeks ago   4.46GB
    
    

    查看 正在运行的 容器

    sudo docker ps -a
    
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~/Docker$ sudo docker ps -a
    CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
    
    

    为库中镜像改名

    sudo docker tag {imageID} {repository}:{tag}
    
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~/Docker$ sudo docker tag 0dd9ea953585 ubuntu:cuda10-ubuntu18
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~/Docker$ sudo docker images -a
    REPOSITORY    TAG                             IMAGE ID       CREATED       SIZE
    ubuntu        cuda10-ubuntu18                 0dd9ea953585   3 weeks ago   4.46GB
    nvidia/cuda   10.2-cudnn8-devel-ubuntu18.04   0dd9ea953585   3 weeks ago   4.46GB
    
    

    删除多余的镜像

    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker images 
    REPOSITORY        TAG                             IMAGE ID       CREATED         SIZE
    newubuntu         cuda10-ubuntu18                 0dd9ea953585   3 weeks ago     4.46GB
    ubuntu            cuda10-ubuntu18                 0dd9ea953585   3 weeks ago     4.46GB
    nvidia/cuda       10.2-cudnn8-devel-ubuntu18.04   0dd9ea953585   3 weeks ago     4.46GB
    pytorch/pytorch   1.6.0-cuda10.1-cudnn7-devel     bb833e4d631f   21 months ago   7.04GB
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker rmi ubuntu:cuda10-ubuntu18
    Untagged: ubuntu:cuda10-ubuntu18
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker rmi ubuntu:cuda10-ubuntu18
    Error: No such image: ubuntu:cuda10-ubuntu18
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker images
    REPOSITORY        TAG                             IMAGE ID       CREATED         SIZE
    nvidia/cuda       10.2-cudnn8-devel-ubuntu18.04   0dd9ea953585   3 weeks ago     4.46GB
    newubuntu         cuda10-ubuntu18                 0dd9ea953585   3 weeks ago     4.46GB
    pytorch/pytorch   1.6.0-cuda10.1-cudnn7-devel     bb833e4d631f   21 months ago   7.04GB
    

    pytorch镜像测试

    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker images -a
    [sudo] liuhz 的密码: 
    REPOSITORY        TAG                               IMAGE ID       CREATED         SIZE
    newubuntu         cuda10-ubuntu18                   0dd9ea953585   3 weeks ago     4.46GB
    nvidia/cuda       10.2-cudnn8-devel-ubuntu18.04     0dd9ea953585   3 weeks ago     4.46GB
    nvidia/cuda       11.4.0-cudnn8-devel-ubuntu20.04   1885dcefbe89   7 months ago    9.01GB
    pytorch/pytorch   1.6.0-cuda10.1-cudnn7-devel       bb833e4d631f   21 months ago   7.04GB
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ sudo docker run -it --rm --name test --gpus all pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel
    root@1f8ac7edb753:/workspace# import torch
    bash: import: command not found
    root@1f8ac7edb753:/workspace# nvidia-smi
    Wed Apr 27 16:42:45 2022       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 470.103.01   Driver Version: 470.103.01   CUDA Version: 11.4     |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |                               |                      |               MIG M. |
    |===============================+======================+======================|
    |   0  NVIDIA GeForce ...  Off  | 00000000:18:00.0 Off |                  N/A |
    | 81%   74C    P2   332W / 350W |  23868MiB / 24268MiB |    100%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
    |   1  NVIDIA GeForce ...  Off  | 00000000:3B:00.0 Off |                  N/A |
    | 73%   70C    P2   250W / 350W |  23631MiB / 24268MiB |    100%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
    |   2  NVIDIA GeForce ...  Off  | 00000000:5E:00.0 Off |                  N/A |
    | 58%   63C    P2   268W / 350W |  22753MiB / 24268MiB |    100%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
    |   3  NVIDIA GeForce ...  Off  | 00000000:86:00.0 Off |                  N/A |
    | 58%   62C    P2   209W / 350W |  15465MiB / 24268MiB |     85%      Default |
    |                               |                      |                  N/A |
    +-------------------------------+----------------------+----------------------+
                                                                                   
    +-----------------------------------------------------------------------------+
    | Processes:                                                                  |
    |  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
    |        ID   ID                                                   Usage      |
    |=============================================================================|
    +-----------------------------------------------------------------------------+
    
    root@1f8ac7edb753:/# conda list 
    
    conda-package-handling    1.6.1            py37h7b6447c_0  
    cryptography              2.9.2            py37h1ba5d50_0  
    cudatoolkit               10.1.243             h6bb024c_0  
    decorator                 4.4.2                      py_0  
    filelock                  3.0.12                     py_0  
    freetype                  2.10.2               h5ab3b9f_0  
    glob2                     0.7                        py_0  
    icu                       58.2                 he6710b0_3  
    idna                      2.9                        py_1  
    intel-openmp              2020.1                      217  
    ipython                   7.16.1           py37h5ca1d4c_0  
    ipython_genutils          0.2.0                    py37_0  
    jedi                      0.17.1                   py37_0  
    jinja2                    2.11.2                     py_0  
    jpeg                      9b                   h024ee3a_2  
    lcms2                     2.11                 h396b838_0  
    ld_impl_linux-64          2.33.1               h53a641e_7  
    libarchive                3.4.2                h62408e4_0  
    libedit                   3.1.20181209         hc058e9b_0  
    libffi                    3.3                  he6710b0_1  
    libgcc-ng                 9.1.0                hdf63c60_0  
    libgfortran-ng            7.3.0                hdf63c60_0  
    liblief                   0.10.1               he6710b0_0  
    libpng                    1.6.37               hbc83047_0  
    libstdcxx-ng              9.1.0                hdf63c60_0  
    libtiff                   4.1.0                h2733197_1  
    libxml2                   2.9.10               he19cac6_1  
    lz4-c                     1.9.2                he6710b0_0  
    markupsafe                1.1.1            py37h14c3975_1  
    mkl                       2020.1                      217  
    mkl-service               2.3.0            py37he904b0f_0  
    mkl_fft                   1.1.0            py37h23d657b_0  
    mkl_random                1.1.1            py37h0573a6f_0  
    ncurses                   6.2                  he6710b0_1  
    ninja                     1.9.0            py37hfd86e86_0  
    numpy                     1.18.5           py37ha1c710e_0  
    numpy-base                1.18.5           py37hde5b4d6_0  
    olefile                   0.46                     py37_0  
    openssl                   1.1.1g               h7b6447c_0  
    parso                     0.7.0                      py_0  
    patchelf                  0.11                 he6710b0_0  
    pexpect                   4.8.0                    py37_1  
    pickleshare               0.7.5                 py37_1001  
    pillow                    7.2.0            py37hb39fc2d_0  
    pip                       20.0.2                   py37_3  
    pkginfo                   1.5.0.1                  py37_0  
    prompt-toolkit            3.0.5                      py_0  
    psutil                    5.7.0            py37h7b6447c_0  
    ptyprocess                0.6.0                    py37_0  
    py-lief                   0.10.1           py37h403a769_0  
    pycosat                   0.6.3            py37h7b6447c_0  
    pycparser                 2.20                       py_0  
    pygments                  2.6.1                      py_0  
    pyopenssl                 19.1.0                   py37_0  
    pysocks                   1.7.1                    py37_0  
    python                    3.7.7                hcff3b4d_5  
    python-libarchive-c       2.9                        py_0  
    pytorch                   1.6.0           py3.7_cuda10.1.243_cudnn7.6.3_0    pytorch
    pytz                      2020.1                     py_0  
    pyyaml                    5.3.1            py37h7b6447c_0  
    readline                  8.0                  h7b6447c_0  
    requests                  2.23.0                   py37_0  
    ripgrep                   11.0.2               he32d670_0  
    ruamel_yaml               0.15.87          py37h7b6447c_0  
    setuptools                46.4.0                   py37_0  
    six                       1.14.0                   py37_0  
    soupsieve                 2.0.1                      py_0  
    sqlite                    3.31.1               h62c20be_1  
    tk                        8.6.10               hbc83047_0  
    torchvision               0.7.0                py37_cu101    pytorch
    tqdm                      4.46.0                     py_0  
    traitlets                 4.3.3                    py37_0  
    urllib3                   1.25.8                   py37_0  
    wcwidth                   0.2.5                      py_0  
    wheel                     0.34.2                   py37_0  
    xz                        5.2.5                h7b6447c_0  
    yaml                      0.1.7                had09818_2  
    zlib                      1.2.11               h7b6447c_3  
    zstd                      1.4.5                h0b5b093_0  
    root@1f8ac7edb753:/# python
    Python 3.7.7 (default, May  7 2020, 21:25:33) 
    [GCC 7.3.0] :: Anaconda, Inc. on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    root@1f8ac7edb753:/# ls
    bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
    boot  etc  lib   media  opt  root  sbin  sys  usr  workspace
    root@1f8ac7edb753:/# python
    Python 3.7.7 (default, May  7 2020, 21:25:33) 
    [GCC 7.3.0] :: Anaconda, Inc. on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import torch
    >>> torch.cuda.is_available()
    True
    >>> 
    
    root@1f8ac7edb753:/# exit
    liuhz@ubuntu-SYS-7049GP-TRTC-RI017:~$ 
    
    

    退出时ctrl+D或者exit

    相关文章

      网友评论

          本文标题:Docker安装和使用学习

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