(2022版)一套教程搞定k8s安装到实战 | Docker基本命令

news/2024/4/15 7:01:38

视频来源:B站《(2022版)最新、最全、最详细的Kubernetes(K8s)教程,从K8s安装到实战一套搞定》

一边学习一边整理老师的课程内容及试验笔记,并与大家分享,侵权即删,谢谢支持!

附上汇总贴:(2022版)一套教程搞定k8s安装到实战 | 汇总_COCOgsta的博客-CSDN博客


[root@k8s-master01 ~]# docker version
Client: Docker Engine - CommunityVersion:           20.10.17API version:       1.40Go version:        go1.17.11Git commit:        100c701Built:             Mon Jun  6 23:05:12 2022OS/Arch:           linux/amd64Context:           defaultExperimental:      trueServer: Docker Engine - CommunityEngine:Version:          19.03.15API version:      1.40 (minimum version 1.12)Go version:       go1.13.15Git commit:       99e3ed8919Built:            Sat Jan 30 03:16:33 2021OS/Arch:          linux/amd64Experimental:     falsecontainerd:Version:          1.6.6GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1runc:Version:          1.1.2GitCommit:        v1.1.2-0-ga916309docker-init:Version:          0.18.0GitCommit:        fec3683
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker info
Client:Context:    defaultDebug Mode: falsePlugins:app: Docker App (Docker Inc., v0.9.1-beta3)buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
WARNING: Plugin "/usr/libexec/docker/cli-plugins/docker-scan" is not valid: failed to fetch metadata: fork/exec /usr/libexec/docker/cli-plugins/docker-scan: exec format errorServer:Containers: 10Running: 4Paused: 0Stopped: 6Images: 5Server Version: 19.03.15Storage Driver: devicemapper # aufs、overlay brtfsPool Name: docker-253:0-3035967-poolPool Blocksize: 65.54kBBase Device Size: 10.74GBBacking Filesystem: xfsUdev Sync Supported: trueData file: /dev/loop0Metadata file: /dev/loop1Data loop file: /var/lib/docker/devicemapper/devicemapper/dataMetadata loop file: /var/lib/docker/devicemapper/devicemapper/metadataData Space Used: 619.4MBData Space Total: 107.4GBData Space Available: 10.63GBMetadata Space Used: 18.56MBMetadata Space Total: 2.147GBMetadata Space Available: 2.129GBThin Pool Minimum Free Space: 10.74GBDeferred Removal Enabled: trueDeferred Deletion Enabled: trueDeferred Deleted Device Count: 0Library Version: 1.02.170-RHEL7 (2020-03-24)Logging Driver: json-file # json-file存在本地Cgroup Driver: systemdPlugins:Volume: localNetwork: bridge host ipvlan macvlan null overlayLog: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslogSwarm: inactiveRuntimes: runcDefault Runtime: runcInit Binary: docker-initcontainerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1runc version: v1.1.2-0-ga916309init version: fec3683Security Options:seccompProfile: defaultKernel Version: 4.19.12-1.el7.elrepo.x86_64Operating System: CentOS Linux 7 (Core)OSType: linuxArchitecture: x86_64CPUs: 2Total Memory: 1.923GiBName: k8s-master01ID: PPTJ:RXWD:5IWS:62IC:2GP4:RKI7:R233:3RGW:D6LN:4IXW:WUUZ:NJHRDocker Root Dir: /var/lib/docker # 可以更改的,ssd的硬盘,最好使用一个单独的磁盘进行挂载Debug Mode: falseRegistry: https://index.docker.io/v1/ # hub.docker.comLabels:Experimental: falseInsecure Registries:127.0.0.0/8Live Restore Enabled: falseWARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release.
WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker search centos
NAME                                         DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                                       The official build of CentOS.                   7199      [OK]       
centos/systemd                               systemd enabled base container.                 108                  [OK]
centos/mysql-57-centos7                      MySQL 5.7 SQL database server                   95                   
kasmweb/centos-7-desktop                     CentOS 7 desktop for Kasm Workspaces            21                   
centos/mongodb-36-centos7                    MongoDB NoSQL database server                   8                    
kasmweb/core-centos-7                        CentOS 7 base image for Kasm Workspaces         3                    
continuumio/centos5_gcc5_base                                                                3                    
couchbase/centos7-systemd                    centos7-systemd images with additional debug…   1                    [OK]
spack/centos7                                CentOS 7 with Spack preinstalled                1                    
spack/centos-stream                                                                          0                    
couchbase/centos-72-jenkins-core                                                             0                    
fnndsc/centos-python3                        Source for a slim Centos-based Python3 image…   0                    [OK]
couchbase/centos-72-java-sdk                                                                 0                    
couchbase/centos-69-sdk-build                                                                0                    
couchbase/centos-70-sdk-build                                                                0                    
datadog/centos-i386                                                                          0                    
spack/centos6                                CentOS 6 with Spack preinstalled                0                    
starlingx/stx-centos                         StarlingX centos                                0                    
ibmcom/fhe-toolkit-centos-amd64              The IBM Fully Homomorphic Encryption (FHE) T…   0                    
ibmcom/fhe-toolkit-centos                    The IBM Fully Homomorphic Encryption (FHE) T…   0                    
apache/couchdbci-centos                      Apache CouchDB CI CentOS                        0                    
silintl/openldap                             OpenLDAP base image on Centos 6                 0                    [OK]
bitnami/centos-extras-base                                                                   0                    
bitnami/centos-base-buildpack                Centos base compilation image                   0                    [OK]
couchbase/centos-69-sdk-nodevtoolset-build                                                   0                    
[root@k8s-master01 ~]# docker search nginx
NAME                                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
nginx                                             Official build of Nginx.                        16983     [OK]       
linuxserver/nginx                                 An Nginx container, brought to you by LinuxS…   169                  
bitnami/nginx                                     Bitnami nginx Docker Image                      131                  [OK]
ubuntu/nginx                                      Nginx, a high-performance reverse proxy & we…   52                   
bitnami/nginx-ingress-controller                  Bitnami Docker Image for NGINX Ingress Contr…   18                   [OK]
rancher/nginx-ingress-controller                                                                  10                   
clearlinux/nginx                                  Nginx reverse proxy server with the benefits…   4                    
ibmcom/nginx-ingress-controller                   Docker Image for IBM Cloud Private-CE (Commu…   4                    
bitnami/nginx-ldap-auth-daemon                                                                    3                    
rancher/nginx                                                                                     2                    
bitnami/nginx-exporter                                                                            2                    
vmware/nginx                                                                                      2                    
rancher/nginx-ingress-controller-defaultbackend                                                   2                    
circleci/nginx                                    This image is for internal use                  2                    
vmware/nginx-photon                                                                               1                    
rapidfort/nginx                                   RapidFort optimized, hardened image for NGINX   1                    
wallarm/nginx-ingress-controller                  Kubernetes Ingress Controller with Wallarm e…   1                    
bitnami/nginx-intel                                                                               1                    
kasmweb/nginx                                     An Nginx image based off nginx:alpine and in…   1                    
rancher/nginx-conf                                                                                0                    
ibmcom/nginx-ingress-controller-ppc64le           Docker Image for IBM Cloud Private-CE (Commu…   0                    
continuumio/nginx-ingress-ws                                                                      0                    
rancher/nginx-ingress-controller-amd64                                                            0                    
ibmcom/nginx-ppc64le                              Docker image for nginx-ppc64le                  0                    
rancher/nginx-ssl                                                                                 0                    
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker pull alpine:latest # 本地若有镜像不会重复拉取
latest: Pulling from library/alpine
2408cc74d12b: Pull complete 
Digest: sha256:686d8c9dfa6f3ccfc8230bc3178d23f84eeaf7e457f36f271ab1acc53015037c
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest
You have new mail in /var/spool/mail/root
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker tag alpine:latest guolianggsta/alpine:latest
[root@k8s-master01 ~]# docker tag alpine:latest guolianggsta/alpine:latest
jConfigure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker push guolianggsta/alpine:latest
The push refers to repository [docker.io/guolianggsta/alpine]
24302eb7d908: Mounted from library/alpine 
latest: digest: sha256:4ff3ca91275773af45cb4b0834e12b7eb47d1c18f770a0b151381cd227f4c253 size: 528
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker run -it alpine:latest  sh
/ # 
/ # 
/ # 
/ # [root@k8s-master01 ~]# docker run -it nginx:1.14.2 sh
Unable to find image 'nginx:1.14.2' locally
1.14.2: Pulling from library/nginx
27833a3ba0a5: Pull complete 
0f23e58bd0b7: Pull complete 
8ca774778e85: Pull complete 
Digest: sha256:f7988fb6c02e0ce69257d9bd9cf37ae20a60f1df7563c3a2a6abe24160306b8d
Status: Downloaded newer image for nginx:1.14.2
# 
# [root@k8s-master01 ~]# docker run -d nginx:1.14.2 sh # -d表示后台启动一个进程
f3925ab212784ce86d350776d3b0daca2688f0a0edf28ff621d1cfe7528e04b9
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker logs -f b1aa9b735420
{"level":"info","msg":"Kubernetes host: https://10.96.0.1:443","time":"2022-06-23T02:13:21Z"}
192.168.1.107 - - [23/Jun/2022:02:13:52 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
192.168.1.107 - - [23/Jun/2022:02:14:02 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
192.168.1.107 - - [23/Jun/2022:02:14:12 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
{"level":"info","msg":"Database updated: 5 nodes, 10 pods","time":"2022-06-23T02:14:21Z"}
192.168.1.107 - - [23/Jun/2022:02:14:22 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
172.25.92.64 - - [23/Jun/2022:02:14:24 +0000] "GET /healthz HTTP/1.1" 200 13 "" "dashboard/v2.0.4"
192.168.1.107 - - [23/Jun/2022:02:14:32 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
192.168.1.107 - - [23/Jun/2022:02:14:42 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
192.168.1.107 - - [23/Jun/2022:02:14:52 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
172.25.92.64 - - [23/Jun/2022:02:14:54 +0000] "GET /healthz HTTP/1.1" 200 13 "" "dashboard/v2.0.4"
192.168.1.107 - - [23/Jun/2022:02:15:02 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
192.168.1.107 - - [23/Jun/2022:02:15:12 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
{"level":"info","msg":"Database updated: 5 nodes, 10 pods","time":"2022-06-23T02:15:21Z"}
192.168.1.107 - - [23/Jun/2022:02:15:22 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
172.25.92.64 - - [23/Jun/2022:02:15:24 +0000] "GET /healthz HTTP/1.1" 200 13 "" "dashboard/v2.0.4"
192.168.1.107 - - [23/Jun/2022:02:15:32 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
192.168.1.107 - - [23/Jun/2022:02:15:42 +0000] "GET / HTTP/1.1" 200 6 "" "kube-probe/1.20"
[root@k8s-master01 ~]# docker ps
CONTAINER ID   IMAGE                                                                 COMMAND              CREATED        STATUS        PORTS     NAMES
b1aa9b735420   86262685d9ab                                                          "/metrics-sidecar"   24 hours ago   Up 24 hours             k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_1
646932befa6a   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"             24 hours ago   Up 24 hours             k8s_POD_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_2
27a98fe675fc   d45bf977dfbf                                                          "start_runit"        24 hours ago   Up 24 hours             k8s_calico-node_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
2bcad372e77e   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"             24 hours ago   Up 24 hours             k8s_POD_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker ps -a
CONTAINER ID   IMAGE                                                                 COMMAND                  CREATED          STATUS                      PORTS     NAMES
f3925ab21278   nginx:1.14.2                                                          "sh"                     20 minutes ago   Exited (0) 20 minutes ago             optimistic_joliot
dc89f8fb24c8   nginx:1.14.2                                                          "sh"                     22 minutes ago   Exited (0) 20 minutes ago             sleepy_borg
04cd7a480254   alpine:latest                                                         "sh"                     24 minutes ago   Exited (0) 23 minutes ago             adoring_faraday
d99c0a30c82c   alpine:latest                                                         "bash"                   24 minutes ago   Created                               distracted_khorana
b1aa9b735420   86262685d9ab                                                          "/metrics-sidecar"       24 hours ago     Up 24 hours                           k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_1
646932befa6a   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago     Up 24 hours                           k8s_POD_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_2
27a98fe675fc   d45bf977dfbf                                                          "start_runit"            24 hours ago     Up 24 hours                           k8s_calico-node_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
ec82192edef4   963564fb95ed                                                          "/usr/local/bin/flex…"   24 hours ago     Exited (0) 24 hours ago               k8s_flexvol-driver_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_0
ab63d540576f   ca5564c06ea0                                                          "/install-cni.sh"        24 hours ago     Exited (0) 24 hours ago               k8s_install-cni_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
2bcad372e77e   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago     Up 24 hours                           k8s_POD_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
6b91d896f94c   registry.cn-beijing.aliyuncs.com/dotbalo/metrics-scraper              "/metrics-sidecar"       44 hours ago     Exited (2) 24 hours ago               k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_0
f15b45ac36ef   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 44 hours ago     Exited (0) 24 hours ago               k8s_POD_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_0
e56fca8267fa   registry.cn-beijing.aliyuncs.com/dotbalo/node                         "start_runit"            47 hours ago     Exited (0) 24 hours ago               k8s_calico-node_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_0
dc9471add10b   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 47 hours ago     Exited (0) 24 hours ago               k8s_POD_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_0
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker ps -q
b1aa9b735420
646932befa6a
27a98fe675fc
2bcad372e77e
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker ps -qa
f3925ab21278
dc89f8fb24c8
04cd7a480254
d99c0a30c82c
b1aa9b735420
646932befa6a
27a98fe675fc
ec82192edef4
ab63d540576f
2bcad372e77e
6b91d896f94c
f15b45ac36ef
e56fca8267fa
dc9471add10b
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker exec -it  27a98fe675fc bash
[root@k8s-master01 /]# 
[root@k8s-master01 /]# 
[root@k8s-master01 /]# ls
@System.solv  bin  boot  calico-secrets  dev  etc  home  included-source  lib  lib64  licenses  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[root@k8s-master01 /]# 
[root@k8s-master01 ~]# echo "test cp" > index.html
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# ls
anaconda-ks.cfg                  index.html            k8s-ha-install                             kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm
etcd-v3.4.13-linux-amd64.tar.gz  initial-setup-ks.cfg  kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm  kubernetes-server-linux-amd64.tar.gz
[root@k8s-master01 ~]# docker cp index.html 6f7256e24436:/usr/share/nginx/html/
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker cp 6f7256e24436:/usr/share/nginx/html/index.html .
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker ps -a
CONTAINER ID   IMAGE                                                                 COMMAND                  CREATED          STATUS                      PORTS                   NAMES
6f7256e24436   nginx:1.14.2                                                          "nginx -g 'daemon of…"   4 minutes ago    Up 4 minutes                0.0.0.0:12345->80/tcp   keen_mccarthy
f3925ab21278   nginx:1.14.2                                                          "sh"                     35 minutes ago   Exited (0) 35 minutes ago                           optimistic_joliot
dc89f8fb24c8   nginx:1.14.2                                                          "sh"                     38 minutes ago   Exited (0) 36 minutes ago                           sleepy_borg
04cd7a480254   alpine:latest                                                         "sh"                     39 minutes ago   Exited (0) 39 minutes ago                           adoring_faraday
d99c0a30c82c   alpine:latest                                                         "bash"                   40 minutes ago   Created                                             distracted_khorana
b1aa9b735420   86262685d9ab                                                          "/metrics-sidecar"       24 hours ago     Up 24 hours                                         k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_1
646932befa6a   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago     Up 24 hours                                         k8s_POD_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_2
27a98fe675fc   d45bf977dfbf                                                          "start_runit"            24 hours ago     Up 24 hours                                         k8s_calico-node_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
ec82192edef4   963564fb95ed                                                          "/usr/local/bin/flex…"   24 hours ago     Exited (0) 24 hours ago                             k8s_flexvol-driver_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_0
ab63d540576f   ca5564c06ea0                                                          "/install-cni.sh"        24 hours ago     Exited (0) 24 hours ago                             k8s_install-cni_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
2bcad372e77e   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago     Up 24 hours                                         k8s_POD_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
6b91d896f94c   registry.cn-beijing.aliyuncs.com/dotbalo/metrics-scraper              "/metrics-sidecar"       44 hours ago     Exited (2) 24 hours ago                             k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_0
f15b45ac36ef   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 44 hours ago     Exited (0) 24 hours ago                             k8s_POD_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_0
e56fca8267fa   registry.cn-beijing.aliyuncs.com/dotbalo/node                         "start_runit"            2 days ago       Exited (0) 24 hours ago                             k8s_calico-node_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_0
dc9471add10b   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 2 days ago       Exited (0) 24 hours ago                             k8s_POD_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_0
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker rm f3925ab21278
f3925ab21278
[root@k8s-master01 ~]# docker images
REPOSITORY                                                        TAG       IMAGE ID       CREATED         SIZE
guolianggsta/alpine                                               latest    e66264b98777   4 weeks ago     5.52MB
alpine                                                            latest    e66264b98777   4 weeks ago     5.52MB
registry.cn-beijing.aliyuncs.com/dotbalo/node                     v3.15.3   d45bf977dfbf   21 months ago   262MB
registry.cn-beijing.aliyuncs.com/dotbalo/pod2daemon-flexvol       v3.15.3   963564fb95ed   21 months ago   22.8MB
registry.cn-beijing.aliyuncs.com/dotbalo/cni                      v3.15.3   ca5564c06ea0   21 months ago   110MB
registry.cn-beijing.aliyuncs.com/dotbalo/metrics-scraper          v1.0.4    86262685d9ab   2 years ago     36.9MB
registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64   3.2       80d28bedfe5d   2 years ago     683kB
nginx                                                             1.14.2    295c7be07902   3 years ago     109MB
[root@k8s-master01 ~]# docker rmi guolianggsta/alpine
Untagged: guolianggsta/alpine:latest
Untagged: guolianggsta/alpine@sha256:4ff3ca91275773af45cb4b0834e12b7eb47d1c18f770a0b151381cd227f4c253
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker ps
CONTAINER ID   IMAGE                                                                 COMMAND                  CREATED         STATUS         PORTS                   NAMES
6f7256e24436   nginx:1.14.2                                                          "nginx -g 'daemon of…"   6 minutes ago   Up 6 minutes   0.0.0.0:12345->80/tcp   keen_mccarthy
b1aa9b735420   86262685d9ab                                                          "/metrics-sidecar"       24 hours ago    Up 24 hours                            k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_1
646932befa6a   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago    Up 24 hours                            k8s_POD_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_2
27a98fe675fc   d45bf977dfbf                                                          "start_runit"            24 hours ago    Up 24 hours                            k8s_calico-node_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
2bcad372e77e   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago    Up 24 hours                            k8s_POD_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker stop 6f7256e24436
6f7256e24436
[root@k8s-master01 ~]# docker ps
CONTAINER ID   IMAGE                                                                 COMMAND              CREATED        STATUS        PORTS     NAMES
b1aa9b735420   86262685d9ab                                                          "/metrics-sidecar"   24 hours ago   Up 24 hours             k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_1
646932befa6a   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"             24 hours ago   Up 24 hours             k8s_POD_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_2
27a98fe675fc   d45bf977dfbf                                                          "start_runit"        24 hours ago   Up 24 hours             k8s_calico-node_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
2bcad372e77e   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"             24 hours ago   Up 24 hours             k8s_POD_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker start 6f7256e24436
6f7256e24436
[root@k8s-master01 ~]# docker ps 
CONTAINER ID   IMAGE                                                                 COMMAND                  CREATED         STATUS         PORTS                   NAMES
6f7256e24436   nginx:1.14.2                                                          "nginx -g 'daemon of…"   7 minutes ago   Up 7 seconds   0.0.0.0:12345->80/tcp   keen_mccarthy
b1aa9b735420   86262685d9ab                                                          "/metrics-sidecar"       24 hours ago    Up 24 hours                            k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_1
646932befa6a   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago    Up 24 hours                            k8s_POD_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_2
27a98fe675fc   d45bf977dfbf                                                          "start_runit"            24 hours ago    Up 24 hours                            k8s_calico-node_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
2bcad372e77e   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago    Up 24 hours                            k8s_POD_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker history alpine
IMAGE          CREATED       CREATED BY                                      SIZE      COMMENT
e66264b98777   4 weeks ago   /bin/sh -c #(nop)  CMD ["/bin/sh"]              0B        
<missing>      4 weeks ago   /bin/sh -c #(nop) ADD file:8e81116368669ed3d…   5.52MB    
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker ps
CONTAINER ID   IMAGE                                                                 COMMAND                  CREATED         STATUS         PORTS                   NAMES
6f7256e24436   nginx:1.14.2                                                          "nginx -g 'daemon of…"   9 minutes ago   Up 2 minutes   0.0.0.0:12345->80/tcp   keen_mccarthy
b1aa9b735420   86262685d9ab                                                          "/metrics-sidecar"       24 hours ago    Up 24 hours                            k8s_dashboard-metrics-scraper_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_1
646932befa6a   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago    Up 24 hours                            k8s_POD_dashboard-metrics-scraper-7645f69d8c-92hzc_kubernetes-dashboard_b5bd764b-b520-4450-99d9-aac6c55e8316_2
27a98fe675fc   d45bf977dfbf                                                          "start_runit"            24 hours ago    Up 24 hours                            k8s_calico-node_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
2bcad372e77e   registry.cn-hangzhou.aliyuncs.com/google_containers/pause-amd64:3.2   "/pause"                 24 hours ago    Up 24 hours                            k8s_POD_calico-node-tstnv_kube-system_9f4ae917-7448-4a99-aca2-f7126c768a0a_1
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker cp index.html 6f7256e24436:/usr/share/nginx/html/
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker commit -a "guolianggsta" -m "add index.html" 6f7256e24436 nginx:commit
sha256:029ceeabb47df6459ce0745b691a2ef1477e3627ff3371ccffd481534ebe6c47
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# 
[root@k8s-master01 ~]# docker run -it --rm nginx:commit bash
root@bab55273616f:/# cd /usr/share/nginx/html/
root@bab55273616f:/usr/share/nginx/html# ls
50x.html  index.html
root@bab55273616f:/usr/share/nginx/html# ls -l
total 8
-rw-r--r-- 1 root root 537 Dec  4  2018 50x.html
-rw-r--r-- 1 root root   8 Jun 24 02:32 index.html
root@bab55273616f:/usr/share/nginx/html# 

docker build在之后的课程讲解


http://www.ppmy.cn/news/125948.html

相关文章

11月25日科技资讯|网易回应裁撤生病员工:确实存在简单粗暴不近人情行为

「极客头条」—— 技术人员的新闻圈&#xff01; CSDN 的读者朋友们早上好哇&#xff0c;「极客头条」来啦&#xff0c;快来看今天都有哪些值得我们技术人关注的重要新闻吧。扫描上方二维码进入 CSDN App 可以收听御姐萌妹 Style 的人工版音频哟。 一分钟速览新闻点&#xff…

28. 文件挂载,卸载,mount,语法选项示例,挂载光盘,挂载分区,挂载u盘,挂载移动硬盘,卸载,fuser等使用和示例

本章详细讲解&#xff1a;文件挂载,卸载,mount,语法选项示例,挂载光盘,挂载分区,挂载u盘,挂载移动硬盘,卸载,fuser的使用和示例 文章目录 mount语法选项 fstab文件/etc/fstab文件的作用挂载的限制参数详解mtab 文件的作用&#xff08;了解&#xff09; mount 示例mount 或者 mo…

linux pycharm 的tools选项下没有deployment

一、问题 pycharm 的tools下没有deployment选项&#xff0c;无法进行远程执行。 二、前言 使用的pycharm版本 PyCharm 2019.3.2 (Community Edition) Build #PC-193.6015.41, built on January 21, 2020 Runtime version: 11.0.510-b520.30 amd64 VM: OpenJDK 64-Bit Serve…

❤️Windows10环境下Docker安装主从MySQL5.7数据库❤️

Windows10环境下Docker安装主从MySQL5.7数据库 1 软件环境概览2 Docker分别安装主从MySQL5.7数据库2.1 主数据库安装2.1.1 配置文件2.1.1.1 mysqld.cnf文件 2.1.2、主数据库镜像制作2.1.2.1 Dockerfile文件制作2.1.2.2 构建镜像2.1.2.3 创建网络2.1.2.4 启动容器 2.2 从数据库安…

简单测试:慧荣SM2259XT2+闪迪BICS5,速度喜人

在国内SSD厂家使用的慧荣&#xff08;SMI&#xff09;主控中&#xff0c;SATA协议的产品主要是2258XT、2259XT&#xff0c;但由于架构、制程的更新升级&#xff0c;如今主推的是2259XT2。NVME协议的产品主要是2263XT和2262EN。 在慧荣的主控产品序列号中&#xff0c;带「XT」后…

梅特勒托利多xk3124电子秤说明书_梅特勒托利多称重仪表XK3124 B520

梅特勒托利多称重仪表XK3124 B520 硬件特点: * 10V驱动电压,可驱动最多 4 个350欧姆的模拟式传感器 * 高精度、高分辨率Σ-Δ型A/D转换,内部A/D转换速率大于300次/秒 * 2个高亮白色LED显示器:可分别显示实际称重值、累计重量及累计次数等信息 * 17个键盘,包括数字和功能键…

倍福触摸屏用什么软件_德国Beckhoff模块//倍福控制器//Beckhoff驱动器//倍福触摸屏...

德国Beckhoff官网&#xff0c;倍福常用规格&#xff1a; BC2000 BC3100 BC8100 BC8150 BC9000 BK3150 bk1120 BK1250 BK2000 BK2020 BK3010 BK3100 BK3110 BK3120 BK3150 BK4020 BK5110 BK5120 BK5150 BK5151 BK5200 BK5220 BK8000 BK9103 BK9105 BX3100 BX5200 C5102-0020 C61…

user.dir 是何方神圣。

user.dir 是何方神圣。 据说 System.getProperty("user.dir"); 可以获取我们计算机的系统信息。 那么 user.dir 的参数又该怎么传&#xff0c;ta 又可以获得哪些信息&#xff1f; 话不多说&#xff0c;追溯原因。好在文档注释写的非常详细。 /*** Determines the c…

python安装docx模块出现Import Error: No module named 'exceptions'的解决方案

文章目录 背景介绍原因分析问题解决 背景介绍 python版本 Python 3.6.8IDE版本 PyCharm 2019.3.3 (Professional Edition) Build #PY-193.6494.30, built on February 6, 2020 Runtime version: 11.0.510-b520.38 amd64 Linux 4.18.0-147.el8.x86_64问题描述 导入docx模块报错…

华为智慧办公新品发布,十余款新品款款惊艳

9月13日&#xff0c;华为智慧办公新品发布会如期而至&#xff0c;正式发布华为MateBook 13s笔记本电脑、华为MateBook 14s笔记本电脑、华为MateStation X一体机、华为PixLab X1打印机、华为MateView GT 27英寸曲面屏显示器以及华为MatePad Pro 12.6英寸套装版等十余款新品。 华…

idea插件开发-环境搭建

工欲善其事&#xff0c;必先利其器。——《论语卫灵公》 ideagradle配置 idea下载地址&#xff1a;官网 gradle下载地址&#xff1a;官网 idea与gradle的配置这里就不做过多的赘述了&#xff0c;需要的同学可以参考一下地址进行配置。 idea&#xff1a;https://blog.csdn.…

27. 查看文件系统信息,blkid,xfs_info,dumpe2fs,blkid,语法详解,用法示例

查看文件系统信息&#xff0c;blkid,xfs_info,dumpe2fs,blkid,语法详解,用法示例 文章目录 blikd语法选项示例 xfs_info语法例子输出解释 dumpe2fs语法选项示范 总结友情链接 blikd 查询文件系统类型信息。用来对文件系统类型、LABEL、UUID等信息进行查询。需要事先安装e2fspr…

IntelliJ IDEA调试时点击停止按钮,程序并没有立即停止

Background 调试一段循环更新数据库的程序时&#xff0c;在更新语句处设置了一个断点&#xff0c;明明在更新了一条数据后停止了Debug&#xff0c;但是数据库里的数据却更新了2条。。 IntelliJ IDEA版本信息&#xff1a; IntelliJ IDEA 2019.3.3 (Ultimate Edition) Build #…

华为原厂预装系统出厂系统全系列恢复镜像安装

文件分享地址https://pan.baidu.com/s/16-CUOXJtiHeIw_h-Vou3lQ?pwd8888 HUAWEI MateBook 13 2020(WRTB) HUAWEI MateBook 13(HN&#xff09; HUAWEI MateBook 13 2021(WRTD) HUAWEI MateBook 13 锐龙版(HNL) HUAWEI MateBook 14(KLV) HUAWEI MateBook 14 2020(KLVC) HUAWEI …

intellij idea 启动报错 java.util.concurrent.CompletionException: java.net.BindException: Address already

welcome to my blog 错误描述: 启动intellij idea时报错 java.util.concurrent.CompletionException: java.net.BindException: Address already in use: bindat java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)at java.base…

Intellj IDEA在安装插件后无法打开

Intellj IDEA无法启动工程 Intellj IDEA在安装插件后无法启动工程起因处理经过结果 Intellj IDEA在安装插件后无法启动工程 起因 在换了一台新的笔记本之后&#xff0c;紧跟着也是把所有的环境&#xff0c;以及一些配置重新装了一遍&#xff0c;时隔两三年重新装这些东西&…

华为“杀疯了”:发布“摸鱼”神器10余款新品

或许&#xff0c;​你已经快被华为智慧办公产品包围了。 在笔记本电脑上“刷手机”是一种什么感觉&#xff1f; 比如摸鱼时间&#xff0c;坐在工位上的你可以在电脑上一键打开“开心消消乐”&#xff0c;而其他人只能去洗手间、吸烟区角落&#xff0c;是不是想想就挺爽的&…

OpenGl之变换

目录 缩放 位移 齐次坐标(Homogeneous Coordinates) 旋转 缩放 对一个向量进行缩放(Scaling)就是对向量的长度进行缩放&#xff0c;而保持它的方向不变。由于我们进行的是2维或3维操作&#xff0c;我们可以分别定义一个有2或3个缩放变量的向量&#xff0c;每个变量缩放一个轴…

第八篇、基于Arduino uno,获取MAX30102心率传感器的心率信息——结果导向

0、结果 说明&#xff1a;先来看看串口调试助手显示的结果&#xff0c;第一个值是原始的IR值&#xff0c;第二个值是实时的心跳&#xff0c;第三个值是平均心跳&#xff0c;如果是你想要的&#xff0c;可以接着往下看。 1、外观 说明&#xff1a;MAX30102心率传感器的外观如下…

安科瑞预付费管理系统对于学生公寓的设计

安科瑞 徐浩竣 江苏安科瑞电器制造有限公司 zx acrelxhj 摘要&#xff1a;论文设计了适用于学生公寓的自助式预付费控电控水管理系统&#xff0c;采用多种智能功能&#xff0c;可以监测和显示漏电现象&#xff0c;通过短路、跳线、零线接地等方式防范和记录用户的偷电行为&a…
最新文章