首頁 > 軟體

測試工程師Docker基礎

2021-03-09 20:00:11

學習整理來源 B站 狂神說Java https://space.bilibili.com/95256449/

一、docker概述

1、docker為什麼會出現

本質:所有技術的出現都是因為出現了一些問題,我們需要去解決,才去研究和學習;

問題:

​ 開發環境、測試環境、模擬環境、正式環境等諸多環境都需要進行頻繁的服務更新、環境維護等;

​ 不同的環境由於成本的問題很難做到完全一致和統一,導致同樣的服務在不同環境出現服務不可用等問題;

docker給以上問題提出的解決方案:帶上執行環境一起打包、更新、上線即可。docker的核心思想就是打包裝箱,每個箱子互相隔離,互不影響。

2、docker為什麼火

核心原因:docker十分的輕巧。因為在容器技術出現之前我們使用的都是虛擬技術。

虛擬機器器:在windows上面安裝一個vmware虛擬機器器軟體,通過這個軟體我們可以虛擬出多臺機器;其實虛擬機器器屬於虛擬化技術,docker容器技術其實也屬於虛擬化技術。

虛擬機器器和docker對比:

傳統虛擬機器器技術:虛擬機器器相關硬體資源,執行一個完整的作業系統,然後在該作業系統上面安裝和執行相關需要的軟體;
容器技術:容器公用宿主機相關硬體資源,容器沒有自己的核心也沒有虛擬任何硬體,這樣就輕便了許多。每個容器都相互隔離,並且擁有自己的檔案系統,互不影響;

3、docker優勢

  • 應用更加快速的交付和部署

    傳統:一堆幫助檔案和安裝程式;

    docker:打包映象、釋出測試一件執行;

  • 更便捷的升級和擴容

    使用docker之後,我們部署應用就跟搭積木一樣,專案打包為一個映象,可以很方便的擴充套件容器1、容器2等

  • 更簡單的系統維護

    docker之後,我們的開發環境、測試環境、線上環境是高度一致的;

  • 更高效的計算資源利用

    docker是一個核心級別的虛擬化技術,可以在一臺物理機上執行多個容器範例。伺服器的效能可以被壓榨到極致;

二、docker安裝

1、docker基本組成

![image-20210306142331618](/Users/zhaoyang/Library/Application Support/typora-user-images/image-20210306142331618.png)

  • 映象(image)

    docker映象就好比是一個目標,可以通過這個目標來建立容器服務,tomcat映象>run>容器(提

    供伺服器),通過這個映象可以建立多個容器(最終服務執行或者專案執行就是在容器中的)。

  • 容器(container)

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

    啟動,停止,刪除,基本命令

    目前就可以把這個容器理解為就是一個簡易的 Linux系統。

  • 倉庫(repository)

    倉庫就是存放映象的地方!

    倉庫分為公有倉庫和私有倉庫。(很類似git)

    Docker Hub是國外的。

2、docker安裝

直接yum安裝即可:

#檢視linux核心版本
[root@ecs-x-large-2-linux-20200305213344 ~]# uname -r
3.10.0-1160.6.1.el7.x86_64

#檢視系統版本詳情
[root@ecs-x-large-2-linux-20200305213344 ~]# 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"

#檢視docker是否安裝成功
[root@ecs-x-large-2-linux-20200305213344 ~]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-203.git0be3e21.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      0be3e21/1.13.1
 Built:           Thu Nov 12 15:11:46 2020
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-203.git0be3e21.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      0be3e21/1.13.1
 Built:           Thu Nov 12 15:11:46 2020
 OS/Arch:         linux/amd64
 Experimental:    false
 
 #測試docker
 [root@ecs-x-large-2-linux-20200305213344 ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
b8dfde127a29: Pull complete
Digest: sha256:89b647c604b2a436fc3aa56ab1ec515c26b085ac0c15b0d105bc475be15738fb
Status: Downloaded newer image for docker.io/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/
 
 #檢視下載後的映象
 [root@ecs-x-large-2-linux-20200305213344 ~]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
docker.io/hello-world   latest              d1165f221234        7 hours ago         13.3 kB
docker.io/nginx         latest              35c43ace9216        2 weeks ago         133 MB

3、docker執行原理

docker是一個client-server結構的系統,docker的守護行程執行在主機上,通過socker從使用者端存取。server接收到client指令,就只執行這個命令。

三、docker常用命令

1、幫助命令

docker version #顯示dokcer版本資訊
docker info #顯示docker的系統資訊,包括映象和容器數量
docker 命令 --help #幫助命令

2、映象命令

docker images #檢視所有本地主機上的映象
docker search #搜尋某個映象
docker pull #下載映象
docker rmi #刪除映象

docker images #檢視所有本地主機上的映象

[root@ecs-x-large-2-linux-20200305213344 ~]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
docker.io/hello-world   latest              d1165f221234        7 hours ago         13.3 kB
docker.io/nginx         latest              35c43ace9216        2 weeks ago         133 MB
#解釋

#REPOSITORY  映象的倉庫源
#TAG         映象標籤
#IMAGE ID    映象id
#CREATED     映象建立時間
#SIZE        映象大小

#可選項
Options:
  -a, --all             Show all images (default hides intermediate images)#檢視所有映象
  -q, --quiet           Only show numeric IDs #只顯示映象id
  
[root@ecs-x-large-2-linux-20200305213344 ~]# docker images -aq  #顯示所有映象id
d1165f221234
35c43ace9216

docker pull #下載映象

#下載映象 docker pull 映象名[:tag]  如果不寫tag預設下載最新
[root@ecs-x-large-2-linux-20200305213344 ~]# docker pull redis
Using default tag: latest
Trying to pull repository docker.io/library/redis ...
latest: Pulling from docker.io/library/redis
45b42c59be33: Already exists   #分層下載
5ce2e937bf62: Pull complete
2a031498ff58: Pull complete
2f3d47096658: Pull complete
04f5cb8ac4c0: Pull complete
9ed141398658: Pull complete
Digest: sha256:9a1a2bb9fd2bd8b2c15aaca44d8e6ba8bc448df9b7b8d7d24ba4b472e0da1b8a
Status: Downloaded newer image for docker.io/redis:latest #映象的真實地址

docker rmi #刪除映象

docker rmi -f 映象id #刪除指定的映象 
docker rmi -f 映象id 映象id #刪除指定的映象 
docker rmi -f $(docker images -aq) #刪除全部的映象

3、容器命令

備註:我們有了映象才能建立容器

docker run 映象id #新建容器並啟動 
docker ps #列出所有執行的容器 
docker rm 容器id #刪除指定容器 
docker start 容器id #啟動容器 
docker restart容器id #重啟容器 
docker stop 容器id #停止當前正在執行的容器 
docker kill 容器id #強制停止當前容器
#檢視容器所有命令
[root@ecs-x-large-2-linux-20200305213344 ~]# docker container

Usage:	docker container COMMAND

Manage containers

Options:
      --help   Print usage

Commands:
  attach      Attach to a running container
  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 on a container's filesystem
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  inspect     Display detailed information on one or more containers
  kill        Kill one or more running containers
  logs        Fetch the logs of a container
  ls          List containers
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  prune       Remove all stopped containers
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  run         Run a command in a new container
  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
  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
  wait        Block until one or more containers stop, then print their exit codes

新建容器並啟動

docker runb [可選引數] image
#引數說明
--name =」name「 #容器名字,用於區分不同的的容器
-d #後臺執行
-it #使用互動模式執行,進入容器檢視相關內容
-p #指定容器埠
	-p 主機埠:容器埠
	
#測試-it
[root@ecs-x-large-2-linux-20200305213344 ~]# docker run -it 300e315adb2f /bin/bash
[root@9f5b41ce646c /]# ls
bin  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[root@9f5b41ce646c /]# exit  #退出容器
exit

#測試 --name -p -d
[root@ecs-x-large-2-linux-20200305213344 ~]# docker run --name nginx01 -d -p 3334:80 35c43ace9216
cacf7a960d29dc24755f6b9896aaa85f2e9f902ff7f620470c907acf5e17bd7a
[root@ecs-x-large-2-linux-20200305213344 ~]# curl localhost:3334
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title> #成功存取3334埠
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

#測試是否後臺執行
[root@ecs-x-large-2-linux-20200305213344 ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                  NAMES
cacf7a960d29        35c43ace9216        "/docker-entrypoin..."   About a minute ago   Up About a minute   0.0.0.0:3334->80/tcp   nginx01

列出所有執行的容器

#docker ps #列出當前正在執行的容器
Options:
  -a, --all             Show all containers (default shows just running)#列出目前所有容器
  -q, --quiet           Only display numeric IDs #只顯示容器id
  
[root@ecs-x-large-2-linux-20200305213344 ~]# docker ps -aq    #顯示所有容器id
9f5b41ce646c
7aab85f14183

退出容器

exit #退出容器

刪除容器

docker rm 容器id #刪除指定的容器,不能刪除正在執行的容器,如果要強制刪除 rm -rf docker 
rm -f $(docker ps -aq) #刪除指定的容器 
docker ps -a -q|xargs docker rm #刪除所有的容器

啟動和停止容器

docker start 容器id #啟動容器 
docker restart 容器id #重啟容器 
docker stop 容器id #停止當前正在執行的容器 
docker kill 容器id #強制停止當前容器

檢視紀錄檔

[root@ecs-x-large-2-linux-20200305213344 ~]# docker logs --help

Options:
      --details        Show extra details provided to logs
  -f, --follow         Follow log output
      --help           Print usage
      --since string   Show logs since timestamp
      --tail string    Number of lines to show from the end of the logs (default "all")
  -t, --timestamps     Show timestamps
  
#顯示紀錄檔
-tf #顯示紀錄檔資訊(一直更新)
--tail number #需要顯示紀錄檔條數
docker logs -t --tail n 容器id #檢視n行紀錄檔 docker logs -ft 容器id #跟著紀錄檔

檢視容器中的程序資訊

#docker top 容器id 
[root@ecs-x-large-2-linux-20200305213344 ~]# docker top cacf7a960d29
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                27859               27841               0                   16:26               ?                   00:00:00            nginx: master process nginx -g daemon off;
101                 27908               27859               0                   16:26               ?                   00:00:00            nginx: worker process

檢視容器後設資料

#docker inspect 容器id
[root@ecs-x-large-2-linux-20200305213344 ~]# docker inspect cacf7a960d29
[
    {
        "Id": "cacf7a960d29dc24755f6b9896aaa85f2e9f902ff7f620470c907acf5e17bd7a",
        "Created": "2021-03-06T08:26:19.015315592Z",
        "Path": "/docker-entrypoint.sh",
        "Args": [
            "nginx",
            "-g",
            "daemon off;"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 27859,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2021-03-06T08:26:19.32665951Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:35c43ace9216212c0f0e546a65eec93fa9fc8e96b25880ee222b7ed2ca1d2151",
        "ResolvConfPath": "/var/lib/docker/containers/cacf7a960d29dc24755f6b9896aaa85f2e9f902ff7f620470c907acf5e17bd7a/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/cacf7a960d29dc24755f6b9896aaa85f2e9f902ff7f620470c907acf5e17bd7a/hostname",
        "HostsPath": "/var/lib/docker/containers/cacf7a960d29dc24755f6b9896aaa85f2e9f902ff7f620470c907acf5e17bd7a/hosts",
        "LogPath": "",
        "Name": "/nginx01",
        "RestartCount": 0,
        "Driver": "overlay2",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {

進入當前正在執行的容器

#我們通常容器都是在後臺執行方式,如果需要修改一些設定或其他操作,那麼我們需要進入執行的容器
#方式一:docker exec - it容器id /bin/bash
[root@ecs-x-large-2-linux-20200305213344 ~]# docker exec -it cacf7a960d29 /bin/bash
root@cacf7a960d29:/# ls
bin   dev		   docker-entrypoint.sh  home  lib64  mnt  proc  run   srv  tmp  var
boot  docker-entrypoint.d  etc			 lib   media  opt  root  sbin  sys  usr
#方式二:docker attach 容器id
[root@ecs-x-large-2-linux-20200305213344 ~]# docker attach cacf7a960d29
正在執行的程式碼******
[root@ecs-x-large-2-linux-20200305213344 ~]#  #ctrl+c 退出
#區別
#docker exec #進入當前容器後開啟一個新的終端,可以在裡面操作。(常用)
#docker attach # 進入容器正在執行的終端

從容器內拷貝到主機

#docker cp 容器id:容器內路徑 主機目的路徑

#測試
#進入容器內部
[root@ecs-x-large-2-linux-20200305213344 ~]# docker exec -it cacf7a960d29 /bin/bash
root@cacf7a960d29:/# ls
bin   dev		   docker-entrypoint.sh  home  lib64  mnt  proc  run   srv  tmp  var
boot  docker-entrypoint.d  etc			 lib   media  opt  root  sbin  sys  usr
#新建一個檔案
root@cacf7a960d29:/# echo "hello" >test.java
root@cacf7a960d29:/# ls
bin   dev		   docker-entrypoint.sh  home  lib64  mnt  proc  run   srv  test.java  usr
boot  docker-entrypoint.d  etc			 lib   media  opt  root  sbin  sys  tmp        var
#退出容器
exit
#拷貝
docker cp cacf7a960d29:test.java /home/
#驗證是否copy到主機
[root@ecs-x-large-2-linux-20200305213344 ~]# ls /home/
test.java

commit映象

命令:docker commit -m=「描述資訊」 -a=「作者」 容器id 目標映象名:[tag]

實戰測試:
#1、啟動tomcat預設映象檔案
[root@ecs-x-large-2-linux-20200305213344 ~]# docker run -d -p 3344:8080 bf4709e77b18
7984fe235242c4164dcede5053663a44db96ae89e0035a13e351faab03634d17
#2、檢視容器的webapp檔案
[root@ecs-x-large-2-linux-20200305213344 ~]# docker exec -it 7984fe235242c4164dcede5053663a44db96ae89e0035a13e351faab03634d17 /bin/bash
root@7984fe235242:/usr/local/tomcat# ls
BUILDING.txt	 LICENSE  README.md	 RUNNING.txt  conf  logs	    temp     webapps.dist
CONTRIBUTING.md  NOTICE   RELEASE-NOTES  bin	      lib   native-jni-lib  webapps  work
root@7984fe235242:/usr/local/tomcat# cd webapps
root@7984fe235242:/usr/local/tomcat/webapps# ls
#3、拷貝webapps.dist下檔案到webapps下
root@7984fe235242:/usr/local/tomcat# cp -r webapps.dist/* webapps/
root@7984fe235242:/usr/local/tomcat# ls webapps
ROOT  docs  examples  host-manager  manager
root@7984fe235242:/usr/local/tomcat#
#4、將該容器提交為一個新的映象檔案
[root@ecs-x-large-2-linux-20200305213344 ~]# docker commit -m="梵響測試容器提交為一個新的映象" -a="fanxiang" 7984fe235242c4164dcede5053 tomcat01:1.0
sha256:3622a772f2315dc2d22140698a45cc8c30a9c8b5e7fb961937429307669ced92
[root@ecs-x-large-2-linux-20200305213344 ~]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
tomcat01                1.0                 3622a772f231        12 seconds ago      672 MB
docker.io/hello-world   latest              d1165f221234        2 days ago          13.3 kB
docker.io/redis         5.0                 d00afcde654e        5 days ago          98.4 MB
docker.io/redis         latest              f877e80bb9ef        5 days ago          105 MB
docker.io/nginx         latest              35c43ace9216        2 weeks ago         133 MB
docker.io/tomcat        latest              bf4709e77b18        3 weeks ago         667 MB
docker.io/centos        latest              300e315adb2f        3 months ago        209 MB

save映象

[root@ecs-x-large-2-linux-20200305213344 ~]#docker save --help
Usage:	docker save [OPTIONS] IMAGE [IMAGE...]
Save one or more images to a tar archive (streamed to STDOUT by default)
Options:
      --help            Print usage
  -o, --output string   Write to a file, instead of STDOUT
  
實戰:
[root@ecs-x-large-2-linux-20200305213344 ~]# docker save -o /home/redis01.tar docker.io/redis:5.0
[root@ecs-x-large-2-linux-20200305213344 ~]# ls /home
redis01.tar  test.java  tomcat02.tar

load映象

[root@ecs-x-large-2-linux-20200305213344 ~]# docker load --help
Usage:	docker load [OPTIONS]
Load an image from a tar archive or STDIN
Options:
      --help           Print usage
  -i, --input string   Read from tar archive file, instead of STDIN
  -q, --quiet          Suppress the load output
實戰:

[root@ecs-x-large-2-linux-20200305213344 ~]# docker load -i /home/redis01.tar
01b7eeecc774: Loading layer [==================================================>]  24.7 MB/24.7 MB
f2df42e57d5e: Loading layer [==================================================>] 1.536 kB/1.536 kB
b537eb7339bc: Loading layer [==================================================>] 3.584 kB/3.584 kB
Loaded image: docker.io/redis:5.0
[root@ecs-x-large-2-linux-20200305213344 ~]# docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
docker.io/hello-world   latest              d1165f221234        2 days ago          13.3 kB
docker.io/redis         5.0                 d00afcde654e        5 days ago          98.4 MB
docker.io/redis         latest              f877e80bb9ef        5 days ago          105 MB
docker.io/nginx         latest              35c43ace9216        2 weeks ago         133 MB
docker.io/tomcat        latest              bf4709e77b18        3 weeks ago         667 MB
docker.io/centos        latest              300e315adb2f        3 months ago        209 MB

4、命令總結

![image-20210306164709448](/Users/zhaoyang/Library/Application Support/typora-user-images/image-20210306164709448.png)

四、docker映象

1、映象是什麼

映象是一種輕量級、可執行的獨立軟體包,用來打包軟體執行環境和基於執行環境開發的軟體,它包含了執行某個軟體所需的所有內容,包括程式碼、執行時庫、環境變數和設定問價等。

將所有的應用和環境直接打包成映象,就可以直接執行。

2、映象分層原理

docker的映象實際上由一層一層的檔案系統組成,這種層級的檔案系統UnionFS。平時我們安裝進虛擬機器器的CentOS都是好幾個G,為什麼Docker這裡才200M?

對於個精簡的OS,rootfs可以很小,只需要包合最基本的命令,工具和程式庫就可以了,因為底層直接用 Host的kernel,自己只需要提供rootfs就可以了。由此可見對於不同的Linux發行版, boots基本是一致 的, rootfs會有差別,因此不同的發行版可以公用bootfs. 虛擬機器器是分鐘級別,容器是秒級!

3、分層理解

[root@ecs-x-large-2-linux-20200305213344 ~]# docker pull redis:5.0
Trying to pull repository docker.io/library/redis ...
5.0: Pulling from docker.io/library/redis
45b42c59be33: Already exists
5ce2e937bf62: Already exists
2a031498ff58: Already exists
ec50b60c87ea: Pull complete
2bf0c804a5c0: Pull complete
6a3615492950: Pull complete
Digest: sha256:6ba62effb31d8d74e6e2dec4b7ef9c8985e7fcc85c4f179e13f622f5785a4135
Status: Downloaded newer image for docker.io/redis:5.0

docker映象為什麼要採用這種分層的結構呢?

最大的好處,我覺得莫過於資源共用了!比如有多個映象都從相同的Base映象構建而來,那麼宿主機
只需在磁碟上保留一份base映象,同時記憶體中也只需要載入一份base映象,這樣就可以為所有的容器
服務了,而且映象的每一層都可以被共用。

總結:
所有的 Docker映象都起始於一個基礎映象層,當進行修改或培加新的內容時,就會在當前映象層之
上,建立新的映象層。Docker 映象都是唯讀的,當容器啟動時,一個新的可寫層載入到映象的頂部!這一層就是我們通常說的容器層,容器之下的都叫映象層!

檢視docker映象分層資訊

命令:docker inspect 映象id或映象名稱

[root@ecs-x-large-2-linux-20200305213344 ~]# docker inspect d00afcde654e
[
    {
        "Id": "sha256:d00afcde654e3125384d52fb872c88986d2046fa598a12abcee52ff0d98e7562",
        "RepoTags": [
            "docker.io/redis:5.0"
        ],
        "RepoDigests": [
            "docker.io/redis@sha256:6ba62effb31d8d74e6e2dec4b7ef9c8985e7fcc85c4f179e13f622f5785a4135"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2021-03-02T23:29:46.396151327Z",
        "Container": "6a7820655f2592fdc2b254036170652520beb98f79a41e6aedc17987ccec3829",
        "ContainerConfig": {
            "Hostname": "6a7820655f25",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "6379/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.12",
                "REDIS_VERSION=5.0.12",
                "REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-5.0.12.tar.gz",
                "REDIS_DOWNLOAD_SHA=7040eba5910f7c3d38f05ea5a1d88b480488215bdbd2e10ec70d18380108e31e"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) ",
                "CMD ["redis-server"]"
            ],
            "Image": "sha256:f43399b52be67a391b4bf53e210c55002a2bce5e4fa5f1021d4dc9725ec7f537",
            "Volumes": {
                "/data": {}
            },
            "WorkingDir": "/data",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "DockerVersion": "19.03.12",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "6379/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.12",
                "REDIS_VERSION=5.0.12",
                "REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-5.0.12.tar.gz",
                "REDIS_DOWNLOAD_SHA=7040eba5910f7c3d38f05ea5a1d88b480488215bdbd2e10ec70d18380108e31e"
            ],
            "Cmd": [
                "redis-server"
            ],
            "Image": "sha256:f43399b52be67a391b4bf53e210c55002a2bce5e4fa5f1021d4dc9725ec7f537",
            "Volumes": {
                "/data": {}
            },
            "WorkingDir": "/data",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 98358570,
        "VirtualSize": 98358570,
        "GraphDriver": {
            "Name": "overlay2",
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/343be33bc297acdf8bc2b57b335c025ea76b8d1263548ba269c0aefb81aaf28d/diff:/var/lib/docker/overlay2/3302ce8415cd3a8a1e1e9753eebbb38df5b15cc02fef109e30be41f4310ee810/diff:/var/lib/docker/overlay2/44c8b45db6fd63960703e604f43a4acc5633f09a3a91a8d7263ad2f9bfd0d038/diff:/var/lib/docker/overlay2/5eb368e142c6079aa1f507149216281ca79b5df08ba19bad51390d74dfbf3c1f/diff:/var/lib/docker/overlay2/219cf0492ba08d03dc4f2a5649ec1124fff82ebe22c6f9a0a26ccf303be0e0d1/diff",
                "MergedDir": "/var/lib/docker/overlay2/d38f31592715a55459f4556623786c5878014bf8ffdcc1e88506069e32ba75dc/merged",
                "UpperDir": "/var/lib/docker/overlay2/d38f31592715a55459f4556623786c5878014bf8ffdcc1e88506069e32ba75dc/diff",
                "WorkDir": "/var/lib/docker/overlay2/d38f31592715a55459f4556623786c5878014bf8ffdcc1e88506069e32ba75dc/work"
            }
        },
        "RootFS": {
            "Type": "layers",  
            "Layers": [     #映象分層資訊
                "sha256:9eb82f04c782ef3f5ca25911e60d75e441ce0fe82e49f0dbf02c81a3161d1300",
                "sha256:f973e3e0e07c6e9f9418a6dd0c453cd70c7fb87a0826172275883ab4bdb61bf4",
                "sha256:c16b4f3a3f99ebbcd59795b54faf4cdf2e00ee09b85124fda5d0746d64237ca6",
                "sha256:01b7eeecc774b7669892f89fc8b84eea781263448978a411f0f429b867410fc5",
                "sha256:f2df42e57d5eef289656ef8aad072d2828a61e93833e2928a789a88bc2bc1cbc",
                "sha256:b537eb7339bcbff729ebdc63a0f910b39ae3d5540663a74f55081b62e92f66e3"
            ]
        }
    }
]

IT145.com E-mail:sddin#qq.com