亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Docker基礎(1)——安裝Docker

發布時間:2020-08-04 12:45:58 來源:網絡 閱讀:3045 作者:劉景宇 欄目:云計算

配置環境:CentOS-7.5

內存建議最少分配4g;

開啟虛擬化:

Docker基礎(1)——安裝Docker

阿里云開源站點下載docker-ce.repo

[root@www ~]# wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@www ~]# mv docker-ce.repo /etc/yum.repos.d/
[root@www ~]# yum repolist
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror.horizon.vn
源標識                            源名稱                                                    狀態
EPEL/7/x86_64                     CentOS-7 - Base - 163.com                                  9,911
base                              cdrom                                                      9,911
docker-ce-stable/x86_64           Docker CE Stable - x86_64                                     25
epel/x86_64                       Extra Packages for Enterprise Linux 7 - x86_64            12,703
extras/7/x86_64                   CentOS-7 - Extras - 163.com                                  434
updates/7/x86_64                  CentOS-7 - Updates - 163.com                               1,614
repolist: 34,598

 

查看一下其配置文件中的baseurl,是否為國內鏡像資源站點,假如為外網,建議用末行模式修改過來,否則,不僅慢還需要科學上網;

[root@www ~]# cat /etc/yum.repos.d/docker-ce.repo
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-edge]
name=Docker CE Edge - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-edge-debuginfo]
name=Docker CE Edge - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/edge
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-edge-source]
name=Docker CE Edge - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/edge
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
 
[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

 

然后我們直接用yum安裝docker-ce即可;

[root@www ~]# yum install docker-ce
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: mirror.horizon.vn
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 docker-ce.x86_64.3.18.09.0-3.el7 將被 安裝
--> 正在處理依賴關系 container-selinux >= 2.9,它被軟件包 3:docker-ce-18.09.0-3.el7.x86_64 需要
--> 正在處理依賴關系 containerd.io,它被軟件包 3:docker-ce-18.09.0-3.el7.x86_64 需要
--> 正在處理依賴關系 docker-ce-cli,它被軟件包 3:docker-ce-18.09.0-3.el7.x86_64 需要
--> 正在檢查事務
---> 軟件包 container-selinux.noarch.2.2.68-1.el7 將被 安裝
---> 軟件包 containerd.io.x86_64.0.1.2.0-3.el7 將被 安裝
---> 軟件包 docker-ce-cli.x86_64.1.18.09.0-3.el7 將被 安裝
--> 解決依賴關系完成
 
依賴關系解決
 
==================================================================================================
 Package                   架構           版本                     源                        大小
==================================================================================================
正在安裝:
 docker-ce                 x86_64         3:18.09.0-3.el7          docker-ce-stable          19 M
為依賴而安裝:
 container-selinux         noarch         2:2.68-1.el7             extras                    36 k
 containerd.io             x86_64         1.2.0-3.el7              docker-ce-stable          22 M
 docker-ce-cli             x86_64         1:18.09.0-3.el7          docker-ce-stable          14 M
 
事務概要
==================================================================================================
安裝  1 軟件包 (+3 依賴軟件包)
 
總下載量:55 M
安裝大小:235 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): container-selinux-2.68-1.el7.noarch.rpm                             |  36 kB  00:00:03    
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/containerd.io-1.2.0-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
containerd.io-1.2.0-3.el7.x86_64.rpm 的公鑰尚未安裝
(2/4): containerd.io-1.2.0-3.el7.x86_64.rpm                                |  22 MB  00:00:09    
(3/4): docker-ce-cli-18.09.0-3.el7.x86_64.rpm                              |  14 MB  00:00:04    
(4/4): docker-ce-18.09.0-3.el7.x86_64.rpm                                  |  19 MB  00:00:19    
--------------------------------------------------------------------------------------------------
總計                                                              2.8 MB/s |  55 MB  00:00:19    
從 https://mirrors.aliyun.com/docker-ce/linux/centos/gpg 檢索密鑰
導入 GPG key 0x621E9F35:
 用戶ID     : "Docker Release (CE rpm) <docker@docker.com>"
 指紋       : 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 來自       : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
是否繼續?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安裝    : containerd.io-1.2.0-3.el7.x86_64                                              1/4
  正在安裝    : 1:docker-ce-cli-18.09.0-3.el7.x86_64                                          2/4
  正在安裝    : 2:container-selinux-2.68-1.el7.noarch                                         3/4
setsebool:  SELinux is disabled.
  正在安裝    : 3:docker-ce-18.09.0-3.el7.x86_64                                              4/4
  驗證中      : 1:docker-ce-cli-18.09.0-3.el7.x86_64                                          1/4
  驗證中      : 3:docker-ce-18.09.0-3.el7.x86_64                                              2/4
  驗證中      : containerd.io-1.2.0-3.el7.x86_64                                              3/4
  驗證中      : 2:container-selinux-2.68-1.el7.noarch                                         4/4
 
已安裝:
  docker-ce.x86_64 3:18.09.0-3.el7                                                               
 
作為依賴被安裝:
  container-selinux.noarch 2:2.68-1.el7             containerd.io.x86_64 0:1.2.0-3.el7           
  docker-ce-cli.x86_64 1:18.09.0-3.el7            
 
完畢!

建議對docker設置enable屬性,并開啟docker,并查看其版本;

[root@www ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@www ~]# systemctl start  docker
[root@www ~]# docker version
Client:
 Version:           18.09.0
 API version:       1.39
 Go version:        go1.10.4
 Git commit:        4d60db4
 Built:             Wed Nov  7 00:48:22 2018
 OS/Arch:           linux/amd64
 Experimental:      false
 
Server: Docker Engine - Community
 Engine:
  Version:          18.09.0
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.4
  Git commit:       4d60db4
  Built:            Wed Nov  7 00:19:08 2018
  OS/Arch:          linux/amd64
  Experimental:     false

 

Docker是由獨立的倉庫的,其內容一般都docker hub上,所以我們需要在docker hub上申請一個賬號,地址是https://hub.docker.com

Docker基礎(1)——安裝Docker


注意

1. 假如我們第一次申請,我們的瀏覽器也沒有科學上網的插件,那么最后的sign up選項就是灰色無法點擊的,因為我們沒有辦法收到郵件,所以我們需要在我們的瀏覽器上安裝一個插件,以便我們可以科學上網,收到回執郵件;

2. 具體插件名稱為:谷歌訪問助手

3. 教程鏈接:http://www.ggfwzs.com

 

1.申請完賬號后,我們可以簡單的做一個nginx小鏡像進行測試:

Docker基礎(1)——安裝Docker

2.在tag標簽里選擇1.14-apline版本;

Docker基礎(1)——安裝Docker

3.本地安裝nginx:1.14-apline版本(默認先查找本地鏡像倉庫,沒有的話就去docker hub上查找,然后下載到本地,默認不會有動作,所以我們需要在開啟一個Xshell借口來查看信息);

[root@www ~]# docker run --name ngx nginx:1.14-alpine
Unable to find image 'nginx:1.14-alpine' locally
1.14-alpine: Pulling from library/nginx
4fe2ade4980c: Pull complete
c691664ebb08: Pull complete
a6f6a50701b6: Pull complete
5980ba3b5a39: Pull complete
Digest: sha256:75cf17cdf89cbd8da65c83050ebdab1026b98cf217442d6a1f2a8892f47967d7
Status: Downloaded newer image for nginx:1.14-alpine

4.開啟另一個Xshell接口,查看運行信息;

[root@www ~]# docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS               NAMES
2fc0b111434b        nginx:1.14-alpine   "nginx -g 'daemon of…"   About a minute ago   Up About a minute   80/tcp              ngx
[root@www ~]#
[root@www ~]# docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               1.14-alpine         77bae8d00654        5 days ago          17.7MB

 

5.通過inspect查看ngx鏡像的IP地址(最后幾行中有,172.17.0.2);

[root@www ~]# docker inspect ngx
[
    {
        "Id": "2fc0b111434b579f6ffe080abd914cb921be070f20c55ed02ed7645e9a4d7a59",
        "Created": "2018-11-12T12:23:37.39282113Z",
        "Path": "nginx",
        "Args": [
            "-g",
            "daemon off;"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 61533,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2018-11-12T12:23:45.219006468Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:77bae8d0065423e2338884d3698ef5ff9de8dec05a55dc81cf48ae9e78008b3f",
        "ResolvConfPath": "/var/lib/docker/containers/2fc0b111434b579f6ffe080abd914cb921be070f20c55ed02ed7645e9a4d7a59/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/2fc0b111434b579f6ffe080abd914cb921be070f20c55ed02ed7645e9a4d7a59/hostname",
        "HostsPath": "/var/lib/docker/containers/2fc0b111434b579f6ffe080abd914cb921be070f20c55ed02ed7645e9a4d7a59/hosts",
        "LogPath": "/var/lib/docker/containers/2fc0b111434b579f6ffe080abd914cb921be070f20c55ed02ed7645e9a4d7a59/2fc0b111434b579f6ffe080abd914cb921be070f20c55ed02ed7645e9a4d7a59-json.log",
        "Name": "/ngx",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "shareable",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/asound",
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/d1b00e9ba9e8cbafe57bd530da02f7c22a5086e9e1d37ab995d697acb859c502-init/diff:/var/lib/docker/overlay2/9fbe29a9d6e34b27b9151fbb798c9f26a22bf0d2a47938759d1197da5324eb5f/diff:/var/lib/docker/overlay2/569ebba8fa873429effbfd7075a08f61f2fadcf1e09c61fb9feacf7adee21710/diff:/var/lib/docker/overlay2/cd229da595a1b8a9fdd3c40b8c7cad2f9abc0835603abfe5e5226ad4f738e0bb/diff:/var/lib/docker/overlay2/2cd347e2a7d82ceeb12f18b279dda0fa0853f13ab3149aa0787f3f7c685ba622/diff",
                "MergedDir": "/var/lib/docker/overlay2/d1b00e9ba9e8cbafe57bd530da02f7c22a5086e9e1d37ab995d697acb859c502/merged",
                "UpperDir": "/var/lib/docker/overlay2/d1b00e9ba9e8cbafe57bd530da02f7c22a5086e9e1d37ab995d697acb859c502/diff",
                "WorkDir": "/var/lib/docker/overlay2/d1b00e9ba9e8cbafe57bd530da02f7c22a5086e9e1d37ab995d697acb859c502/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [],
        "Config": {
            "Hostname": "2fc0b111434b",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": true,
            "AttachStderr": true,
            "ExposedPorts": {
                "80/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "NGINX_VERSION=1.14.1"
            ],
            "Cmd": [
                "nginx",
                "-g",
                "daemon off;"
            ],
            "ArgsEscaped": true,
            "Image": "nginx:1.14-alpine",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
            },
            "StopSignal": "SIGTERM"
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "ac090b600a21020aa323ccd020688bb0ef7c46df744739d5345996294e663afd",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "80/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/ac090b600a21",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "207649bd5ec943874679a88995a60c07d48b176704106ccd0c95bf226227332d",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "6714eb554a2843bd0582a3e7d63b09b175c5351c100aab08b1a051bc8187cb5c",
                    "EndpointID": "207649bd5ec943874679a88995a60c07d48b176704106ccd0c95bf226227332d",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]

 

6.本地用curl測試ngx鏡像的啟動狀態;

[root@www ~]# curl 172.17.0.2
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h2>Welcome to nginx!</h2>
<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>


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

团风县| 和林格尔县| 孝义市| 尼木县| 哈巴河县| 临夏市| 台州市| 余姚市| 定兴县| 开阳县| 无极县| 湖口县| 华亭县| 富民县| 微山县| 汉川市| 澎湖县| 洪湖市| 富顺县| 托里县| 太保市| 扬中市| 罗山县| 武义县| 伊金霍洛旗| 新民市| 天镇县| 策勒县| 澄江县| 惠州市| 突泉县| 波密县| 孟津县| 托里县| 蓬莱市| 定西市| 应城市| 姚安县| 延寿县| 广丰县| 仁怀市|