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

news/2024/10/15 13:52:52/

视频来源: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…