zoukankan      html  css  js  c++  java
  • Ubuntu Docker安装

    1.检查服务器信息

    root@ryj:/home/wuh151# uname -a
    Linux ryj 4.4.0-186-generic #216-Ubuntu SMP Wed Jul 1 05:34:05 UTC 2020 x86_64 x86_64

    2.卸载旧版本

      Docker 的旧版本被称为 docker,docker.io 或 docker-engine 

    root@ryj:/home/wuh151# apt-get remove docker docker-engine docker.io containerd runc
    Reading package lists... Done
    Building dependency tree       
    Reading state information...

    3.设置仓库

      首次安装 Docker Engine-Community 之前,需要设置 Docker 仓库。

           添加 Docker 的官方 GPG 密钥:

    root@ryj:/home/wuh151# curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
    OK

      设置稳定版仓库

    root@ryj:/home/wuh151# add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

    4.安装 Docker Engine-Community

    root@ryj:/home/wuh151# apt-get update && apt-get install docker-ce docker-ce-cli containerd.io
    Get:1 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu xenial InRelease [66.2 kB]
    Get:2 https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu xenial/stable amd64 Packages [16.4 kB]
    Hit:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
    ....
    
    root@ryj:/home/wuh151# docker version
    Client: Docker Engine - Community
     Version:           20.10.0
     API version:       1.41
     Go version:        go1.13.15
    ...

    5.Docker 启停

      启动安装成功后,是启动状态

    systemctl status    docker   -- 查看
    systemctl start     docker   -- 启动
    systemctl stop      docker   -- 停止
    systemctl enable    docker   -- 开机自启 

    6.Docker 命令

      Docker 1.13在逻辑上将命令分组为管理命令,现在使用docker image ls命令而不是docker images命令获取映像列表。 类似的docker container ls显示的是容器列表,而不是docker ls 。 这为命令带来了很多一致性

    root@ryj-dev10:/home/wuh151# docker --help
    
    Usage:	docker [OPTIONS] COMMAND
    
    A self-sufficient runtime for containers
    
    Options:
          --config string      Location of client config files (default "/root/.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 "/root/.docker/ca.pem")
          --tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")
          --tlskey string      Path to TLS key file (default "/root/.docker/key.pem")
          --tlsverify          Use TLS and verify the remote
      -v, --version            Print version information and quit
    
    Management Commands:
      builder     Manage builds
      config      Manage Docker configs
      container   Manage containers
      context     Manage contexts
      engine      Manage the docker engine
      image       Manage images
      network     Manage networks
      node        Manage Swarm nodes
      plugin      Manage plugins
      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.

     

  • 相关阅读:
    js 递归获取多层树的某个节点
    layui table 打印表格
    tp6 使用queue
    url带参数生成二维码
    redis的常用配置
    《TensorFlow实战》中AlexNet卷积神经网络的训练中
    JavaScript之闭包
    JavaScript之map与parseInt的陷阱
    JavaScript方法中this关键字使用注意
    什么是深度学习?
  • 原文地址:https://www.cnblogs.com/ryjJava/p/14129257.html
Copyright © 2011-2022 走看看