1. 程式人生 > 實用技巧 >allure 測試報告(一)簡介與安裝

allure 測試報告(一)簡介與安裝

docker安裝

docker的基本元件

docker的架構圖

映象(images)

Docker 映象好比是一個模板 eg nginx 映象 -----> run --------> nginx 容器(提供服務)

容器(containers)

Docker 通過容器技術 獨立一個或者一個組的應用 通過映象來建立的

啟動 停止 刪除 等基本命令!

可以將容器理解為一個簡易的linux 系統

倉庫(registray)

倉庫就是儲存映象的!

  • 共有倉庫

    dockerhub

    阿里雲

  • 私有倉庫

安裝docker

環境準備

1.準備一臺centos7

環境檢視

# 系統核心必須是3.0 以上的
[root@localhost ~]# uname -r 
3.10.0-862.el7.x86_64
#檢視系統版本
[root@localhost ~]# uname -r 
3.10.0-862.el7.x86_64
[root@localhost ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

安裝

檢視官方的幫助文件

# 1. 解除安裝舊的版本
$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine
                  
# 2.需要的一些安裝包
$ sudo yum install -y yum-utils
# 3.配置阿里雲的映象源
$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo   #(預設是國外的  非常慢)
    
$ sudo yum-config-manager \
    --add-repo \
  	http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo  #推薦使用阿里雲的
# 4. 安裝 docker 相關的包   docker-ce是社群版(一般安裝社群版)  ee是企業版
$ sudo yum install docker-ce docker-ce-cli containerd.io -y


#預設是安裝最新的版本
$ yum list docker-ce --showduplicates | sort -r  #可以檢視可用的版本
docker-ce.x86_64            3:19.03.12-3.el7                   @docker-ce-stable
docker-ce.x86_64            3:19.03.11-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:19.03.10-3.el7                   docker-ce-stable 
docker-ce.x86_64            3:19.03.0-3.el7                    docker-ce-stable 
docker-ce.x86_64            3:18.09.9-3.el7                    docker-ce-stable 
$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io



# 5. 啟動

[root@localhost ~]# systemctl start docker    # 啟動服務
[root@localhost ~]# systemctl enable docker   #開機自啟動 避免重啟伺服器時 服務起不來
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

# 6. 測試 hello-world
[root@localhost ~]#	docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449bf11e0941a1fd0bf4a8e6c9408b2600777c5
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/
# 7.檢視hello-world映象

# 8.檢視hello-world容器

#9.解除安裝docker
$ sudo yum remove docker-ce docker-ce-cli containerd.io
$ sudo rm -rf /var/lib/docker

配置阿里雲的映象加速

1、登入阿里雲

2、產品和服務

Run 的流程和docker底層原理

1.docker的run流程

2.docker的底層原理

Dokcer 是一個C/S 架構系統 docker守護程序是執行在宿主機上,通過socket從客戶端訪問

DockerServer 通過DockerClient 指令會執行這個命令

docker為什麼比我們的VM快?

1.docker比虛擬機器更少抽象層

2.新建一個docker不會像虛擬機器一樣重新載入一次核心能更好的避免引導所花費時間

由此就能看出 傳統虛擬機器是分鐘級 而docker是秒級的