【服务计算】docker实践报告

环境说明

主机系统:win10 x64
虚拟机管理器:Virtualbox 版本 6.1.0 r135406 (Qt5.6.2)
虚拟机系统:ubuntu-18.04.2-desktop-amd64

准备docker环境

官方指南
中文安装教程
使用 Docker 仓库进行安装

  • 设置仓库
    • 更新 apt 包索引
      sudo apt-get update
      
    • 安装 apt 依赖包,用于通过HTTPS来获取仓库
      sudo apt-get install \
          apt-transport-https \
          ca-certificates \
          curl \
          gnupg-agent \
          software-properties-common
      
    • 添加 Docker 的官方 GPG 密钥
      curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
      
      添加GPG密钥.PNG
    • 通过搜索指纹9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88的后8个字符,即0EBFCD88,验证您现在是否拥有带有指纹的密钥
      sudo apt-key fingerprint 0EBFCD88
      
      验证.PNG
    • 使用以下指令设置稳定版仓库
      sudo add-apt-repository \
         "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
        $(lsb_release -cs) \
        stable"
      
      addRepository.PNG
  • 安装 Docker Engine-Community
    • 更新 apt 包索引
      sudo apt-get update
      
    • 安装最新版本的 Docker Engine-Community 和 containerd
      sudo apt-get install docker-ce docker-ce-cli containerd.io
      
    • 测试 Docker 是否安装成功
      sudo docker version
      
      dockerVersion.PNG

运行第一个容器

运行镜像

sudo docker run hello-world

dockerHelloWorld.PNG

sudo docker run -it ubuntu bash

dockerUbuntuBash.PNG

Docker基本操作

  • 显示本地镜像库内容

    sudo docker images
    

    dockerImages.PNG

  • 获得帮助

    sudo docker --help
    

    输出如下结果:

    Usage:	docker [OPTIONS] COMMAND
    
    A self-sufficient runtime for containers
    
    Options:
          --config string      Location of client config files (default
                               "/home/jiere/.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/jiere/.docker/ca.pem")
          --tlscert string     Path to TLS certificate file (default
                               "/home/jiere/.docker/cert.pem")
          --tlskey string      Path to TLS key file (default
                               "/home/jiere/.docker/key.pem"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值