Docker【安装与基本使用】

news2024/11/26 20:33:16

【1】Docker的安装

注意:如果之前安装过docker其他版本,请删除干净。

docker-01

10.0.0.51

2G

docker-02

10.0.0.52

2G

 docker-01

[root@docker-01 ~]# cp -rp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
cp: overwrite ‘/etc/localtime’? y

[root@docker-01 ~]# ntpdate ntp1.aliyun.com

[root@docker-01 ~]# hwclock --systohc

[root@docker-01 ~]# vim /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=1
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

[root@docker-01 ~]#  wget -O /etc/yum.repos.d/docker-ce.repo http://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
--2023-07-17 21:26:12--  http://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1919 (1.9K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/docker-ce.repo’

100%[=========================================================>] 1,919       --.-K/s   in 0s      

2023-07-17 21:26:12 (10.2 MB/s) - ‘/etc/yum.repos.d/docker-ce.repo’ saved [1919/1919]

[root@docker-01 ~]# sed -i 's+donload.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo

[root@docker-01 ~]# yum -y install docker-ce

[root@docker-01 ~]# mkdir docker-ce
[root@docker-01 ~]# find /var/cache/yum/x86_64/7/ -type f -name "*.rpm" | xargs mv -t docker-ce/

[root@docker-01 ~]# docker version 
Client: Docker Engine - Community
 Version:           24.0.4
 API version:       1.43
 Go version:        go1.20.5
 Git commit:        3713ee1
 Built:             Fri Jul  7 14:54:21 2023
 OS/Arch:           linux/amd64
 Context:           default
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

[root@docker-01 ~]# systemctl start docker
[root@docker-01 ~]# systemctl enable docker

[root@docker-01 ~]# tar -zcvf docker-ce.tar.gz docker-ce/
[root@docker-01 ~]# scp -rp docker-ce.tar.gz root@10.0.0.52:/root
The authenticity of host '10.0.0.52 (10.0.0.52)' can't be established.
ECDSA key fingerprint is 91:14:1f:5c:f9:69:6e:12:5f:fa:dd:61:bc:ef:3e:68.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.52' (ECDSA) to the list of known hosts.
root@10.0.0.52's password: 
docker-ce.tar.gz                                                 100%  116MB 116.5MB/s   00:01   

 docker-02

[root@docker-02 ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2523  100  2523    0     0   6100      0 --:--:-- --:--:-- --:--:--  6108

[root@docker-02 ~]# tar xf docker-ce.tar.gz 
[root@docker-02 ~]# cd docker-ce/
[root@docker-02 docker-ce]# yum localinstall -y *.rpm

[root@docker-02 docker-ce]# systemctl start docker
[root@docker-02 docker-ce]# systemctl enable docker

[root@docker-02 docker-ce]# docker version 
Client: Docker Engine - Community
 Version:           24.0.4
 API version:       1.43
 Go version:        go1.20.5
 Git commit:        3713ee1
 Built:             Fri Jul  7 14:54:21 2023
 OS/Arch:           linux/amd64
 Context:           default

【2】docker常用命令 

搜索镜像 - search

[root@docker-01 ~]# docker search nginx
NAME                                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
nginx                                             Official build of Nginx.                        18762     [OK]       
unit                                              Official build of NGINX Unit: Universal Web …   6         [OK]       

下载镜像 - pull

[root@docker-01 ~]# docker pull nginx:latest
latest: Pulling from library/nginx
faef57eae888: Pull complete 
76579e9ed380: Pull complete 
cf707e233955: Pull complete 
91bb7937700d: Pull complete 
4b962717ba55: Pull complete 
f46d7b05649a: Pull complete 
103501419a0a: Pull complete 
Digest: sha256:08bc36ad52474e528cc1ea3426b5e3f4bad8a130318e3140d6cfe29c8892c7ef
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest

 查看存在的镜像 - image ls

[root@docker-01 ~]# docker image ls
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    021283c8eb95   12 days ago   187MB

## 或使用 images
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    021283c8eb95   12 days ago   187MB

 删除镜像 - image rm

[root@docker-01 ~]# docker image rm nginx:latest 
Untagged: nginx:latest
Untagged: nginx@sha256:08bc36ad52474e528cc1ea3426b5e3f4bad8a130318e3140d6cfe29c8892c7ef
Deleted: sha256:021283c8eb95be02b23db0de7f609d603553c6714785e7a673c6594a624ffbda
Deleted: sha256:a9de33035096cdf7bbaf7f3e1291701c0620d2a0e66152228abef35a79002876
Deleted: sha256:d66c35807d98c6f37bd2a14c6506a42d27a40fbdb564e233f7a78aafdc636c59
Deleted: sha256:a4c423818ed6dc12a545c349d0dc36a5695446448e07229e96c7235a126c2520
Deleted: sha256:c04094edc9df98c870e281f3b947a7782ca6d542d8715814ac06786466af3659
Deleted: sha256:c9c467815e8fe87d99f0f500495cf7f4f9096cf6c116ef2782e84bb17a4a5e06
Deleted: sha256:4645f26713fbea51190f5de52b88fbe27b42efd61c0dba87c81fa16df9a8f649
Deleted: sha256:24839d45ca455f36659219281e0f2304520b92347eb536ad5cc7b4dbb8163588

[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

## 或使用 rmi
[root@docker-01 ~]# docker pull nginx:latest
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    021283c8eb95   12 days ago   187MB
[root@docker-01 ~]# docker rmi nginx:latest 
Untagged: nginx:latest
Untagged: nginx@sha256:08bc36ad52474e528cc1ea3426b5e3f4bad8a130318e3140d6cfe29c8892c7ef
Deleted: sha256:021283c8eb95be02b23db0de7f609d603553c6714785e7a673c6594a624ffbda
Deleted: sha256:a9de33035096cdf7bbaf7f3e1291701c0620d2a0e66152228abef35a79002876
Deleted: sha256:d66c35807d98c6f37bd2a14c6506a42d27a40fbdb564e233f7a78aafdc636c59
Deleted: sha256:a4c423818ed6dc12a545c349d0dc36a5695446448e07229e96c7235a126c2520
Deleted: sha256:c04094edc9df98c870e281f3b947a7782ca6d542d8715814ac06786466af3659
Deleted: sha256:c9c467815e8fe87d99f0f500495cf7f4f9096cf6c116ef2782e84bb17a4a5e06
Deleted: sha256:4645f26713fbea51190f5de52b88fbe27b42efd61c0dba87c81fa16df9a8f649
Deleted: sha256:24839d45ca455f36659219281e0f2304520b92347eb536ad5cc7b4dbb8163588
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

 导出镜像 - save

[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    021283c8eb95   12 days ago   187MB
alpine       latest    c1aabb73d233   4 weeks ago   7.33MB
[root@docker-01 ~]# docker save nginx:latest -o docker_nginx_latest.tar.gz
[root@docker-01 ~]# ls
anaconda-ks.cfg  docker_nginx_latest.tar.gz

 将多个镜像导出到同一个tar包

[root@docker-01 ~]# docker save -o docker_nginx_latest_alpine_laster.tar.gz nginx:latest alpine:latest 
[root@docker-01 ~]# ls
anaconda-ks.cfg  docker_nginx_latest_alpine_laster.tar.gz

 导入镜像 - load

[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
[root@docker-01 ~]# docker load -i docker_nginx_latest.tar.gz 
24839d45ca45: Loading layer [==================================================>]  77.81MB/77.81MB
b821d93f6666: Loading layer [==================================================>]  113.2MB/113.2MB
1998c5cd2230: Loading layer [==================================================>]  3.584kB/3.584kB
f36897eea34d: Loading layer [==================================================>]  4.608kB/4.608kB
9fdfd12bc85b: Loading layer [==================================================>]   2.56kB/2.56kB
434c6a715c30: Loading layer [==================================================>]   5.12kB/5.12kB
3c9d04c9ebd5: Loading layer [==================================================>]  7.168kB/7.168kB
Loaded image: nginx:latest
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    021283c8eb95   12 days ago   187MB

[root@docker-01 ~]# docker load -i docker_nginx_latest_alpine_laster.tar.gz 
Loaded image: nginx:latest
78a822fe2a2d: Loading layer [==================================================>]  7.622MB/7.622MB
Loaded image: alpine:latest
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    021283c8eb95   12 days ago   187MB
alpine       latest    c1aabb73d233   4 weeks ago   7.33MB

导入镜像 - import (使用import导入的镜像,没有名称和tag)

[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
[root@docker-01 ~]# docker import docker_nginx_latest.tar.gz 
sha256:3a1b69daa7117d4087d303a9b9f8264bd6ddd89fc0aa98de15279bc54fd6417f
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
<none>       <none>    3a1b69daa711   8 seconds ago   191MB

 镜像打标签tag - tag

[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
<none>       <none>    50e01e030252   7 seconds ago   191MB
[root@docker-01 ~]# docker tag 50e01e030252 nignx:latest
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
nignx        latest    50e01e030252   36 seconds ago   191MB

 批量导入镜像

[root@docker-01 ~]# ls 
anaconda-ks.cfg  docker_alpine_latest.tar.gz  docker_nginx_latest.tar.gz
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
[root@docker-01 ~]# for i in `ls *.tar.gz` ; do docker load -i ${i} ; done
78a822fe2a2d: Loading layer [==================================================>]  7.622MB/7.622MB
Loaded image: alpine:latest
24839d45ca45: Loading layer [==================================================>]  77.81MB/77.81MB
b821d93f6666: Loading layer [==================================================>]  113.2MB/113.2MB
1998c5cd2230: Loading layer [==================================================>]  3.584kB/3.584kB
f36897eea34d: Loading layer [==================================================>]  4.608kB/4.608kB
9fdfd12bc85b: Loading layer [==================================================>]   2.56kB/2.56kB
434c6a715c30: Loading layer [==================================================>]   5.12kB/5.12kB
3c9d04c9ebd5: Loading layer [==================================================>]  7.168kB/7.168kB
Loaded image: nginx:latest
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
nginx        latest    021283c8eb95   12 days ago   187MB
alpine       latest    c1aabb73d233   4 weeks ago   7.33MB

查看镜像属性信息 - inspect

[root@docker-01 ~]# docker image inspect nignx:latest 
[
    {
        "Id": "sha256:50e01e0302529b75135cdb604390e902edf0d2d33b15a4aad38549364d8a783d",
        "RepoTags": [
            "nignx:latest"
        ],
        "RepoDigests": [],
        "Parent": "",
        "Comment": "Imported from -",
        "Created": "2023-07-17T14:00:39.736859118Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "24.0.4",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 191044723,
        "VirtualSize": 191044723,
        "GraphDriver": {
            "Data": {
                "MergedDir": "/var/lib/docker/overlay2/26712e0da7400f397726cf91ce493a57ddba45fd2888eef4c47a02cb09b3c611/merged",
                "UpperDir": "/var/lib/docker/overlay2/26712e0da7400f397726cf91ce493a57ddba45fd2888eef4c47a02cb09b3c611/diff",
                "WorkDir": "/var/lib/docker/overlay2/26712e0da7400f397726cf91ce493a57ddba45fd2888eef4c47a02cb09b3c611/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:3535316b441652de429ba1b43116475d9096fe29db21febf279c6d34edf7a8f0"
            ]
        },
        "Metadata": {
            "LastTagTime": "2023-07-17T22:01:13.237222336+08:00"
        }
    }
]

 清理无名、无效的镜像 - prune

[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
<none>       <none>    7a3926d49b5c   3 seconds ago   7.62MB
nignx        latest    50e01e030252   2 minutes ago   191MB
[root@docker-01 ~]# docker image prune 
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N] y
Deleted Images:
deleted: sha256:7a3926d49b5c85905e58e97413bb3867e8b4584b4d88a22392ae8d70de6ebd0a
deleted: sha256:827bcdd7ee4f04b14a30f473be61643971d64a7bacb639c1ad1f99d133598987

Total reclaimed space: 7.625MB
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
nignx        latest    50e01e030252   2 minutes ago   191MB

 批量删除镜像、删除没有容器使用的镜像 - system prune

[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
nignx        latest    50e01e030252   3 minutes ago   191MB
alpine       latest    c1aabb73d233   4 weeks ago     7.33MB
[root@docker-01 ~]# docker system prune -a
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all images without at least one container associated to them
  - all build cache

Are you sure you want to continue? [y/N] y
Deleted Images:
untagged: nignx:latest
deleted: sha256:50e01e0302529b75135cdb604390e902edf0d2d33b15a4aad38549364d8a783d
deleted: sha256:3535316b441652de429ba1b43116475d9096fe29db21febf279c6d34edf7a8f0
untagged: alpine:latest
deleted: sha256:c1aabb73d2339c5ebaa3681de2e9d9c18d57485045a4e311d9f8004bec208d67
deleted: sha256:78a822fe2a2d2c84f3de4a403188c45f623017d6a4521d23047c9fbb0801794c

Total reclaimed space: 198.4MB
[root@docker-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
[root@docker-01 ~]# 

创建、启动容器 - run -dit

[root@docker-01 ~]# docker run -dit nginx:latest 
a5ff63d7068da615129595535c0be909ee2055feb836e0584370e19a0fb7181d
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS          PORTS     NAMES
a5ff63d7068d   nginx:latest   "/docker-entrypoint.…"   10 seconds ago   Up 10 seconds   80/tcp    romantic_shtern
[root@docker-01 ~]# 

创建、启动并直接进入容器 - run -it (但是退出后,容器会死掉)

[root@docker-01 ~]# docker run -it alpine:latest 
/ # ls
bin    dev    etc    home   lib    media  mnt    opt    proc   root   run    sbin   srv    sys    tmp    usr    var
/ # exit
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED          STATUS                     PORTS     NAMES
c6e57a2ae517   alpine:latest   "/bin/sh"                15 seconds ago   Exited (0) 2 seconds ago             suspicious_ishizaka

 创建、启动容器让容器一直处于运行状态

[root@docker-01 ~]# docker run -dit alpine:latest 
1f602a2a733ef393edfb32e4958d5169dd40e6f8000e746e96c0743934a2b8e3
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED              STATUS                          PORTS     NAMES
1f602a2a733e   alpine:latest   "/bin/sh"                6 seconds ago        Up 5 seconds                              hungry_chatelet

[root@docker-01 ~]# docker exec -it 1f602a2a733e /bin/ash
/ # exit
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED          STATUS                          PORTS     NAMES
1f602a2a733e   alpine:latest   "/bin/sh"                34 seconds ago   Up 34 seconds                             hungry_chatelet

创建容器,但是不启动 - create 

[root@docker-01 ~]# docker create alpine:latest 
dff9b9819f1ea4d9a472552c5cccf950e8900e08925388f22b304cc0a4881844
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED              STATUS                     PORTS     NAMES
dff9b9819f1e   alpine:latest   "/bin/sh"                3 seconds ago        Created                              trusting_liskov

 创建容器,并指定容器名称 - name

[root@docker-01 ~]# docker run -dit --name test centos:latest
f2e7ddb5c9a3518d6145cd40c4f05813ee788ca33d36cdc2a155896e97d8f08c
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE            COMMAND       CREATED          STATUS          PORTS                               NAMES
f2e7ddb5c9a3   centos:latest    "/bin/bash"   8 seconds ago    Up 7 seconds                                        test

docker服务重启后,自动拉起容器运行

[root@docker-01 ~]# docker run -dit --name test-01 --restart=unless-stopped nginx:latest 
96ce404fc5aab56a290d0da1146b1c5222951d4c02e84e7ac97017527347f8c2
[root@docker-01 ~]# 

----restart=unless-stopped :docker重启后,自动拉起(但是不包含在守护进程重启之前就停止的容器)
----restart=no             : docker重启后, 不自动拉起容器
--restart=always           :docker重启后, 总是拉起容器
--restart=on-failure:3     :docker服务不正常退出并重启后,自动拉起服务,若超过指定3次未拉起容器则放弃

  创建容器,并指定容器最大使用内存 - memory

[root@docker-01 ~]# docker run -dit --name test-mem --memory 256m centos:latest 
927a4400a7570dc04768219aac08188aca5412cd15b6eba91eb42a63c28f9e3b
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE            COMMAND       CREATED          STATUS          PORTS                               NAMES
927a4400a757   centos:latest    "/bin/bash"   5 seconds ago    Up 5 seconds                                        test-mem

[root@docker-01 ~]# docker stats --no-stream 
CONTAINER ID   NAME                CPU %     MEM USAGE / LIMIT     MEM %     NET I/O          BLOCK I/O         PIDS
927a4400a757   test-mem            0.00%     536KiB / 256MiB       0.20%     648B / 0B        0B / 0B           1

[root@docker-01 ~]# docker inspect test-mem | grep -i mem
        "Name": "/test-mem",
            "Memory": 268435456,
            "CpusetMems": "",
            "MemoryReservation": 0,
            "MemorySwap": 536870912,
            "MemorySwappiness": null,

 容器配置swap - memory-swap

[root@docker-01 ~]# docker run -dit --name test --memory 300m --memory-swap 300m nginx:latest 
f86590ceb190c3f4768841e00daa3498e8a52d03ba37acc2c5321f1c7a655ff4

[root@docker-01 ~]# docker run -dit --name test-01 --memory 300m --memory-swap 300m centos:latest 
ad33ab277600a5ecb0c6074d37a0cd9510113827e73bea8d032f2a09245a5cb1

[root@docker-01 ~]# docker stats --no-stream 
CONTAINER ID   NAME      CPU %     MEM USAGE / LIMIT   MEM %     NET I/O     BLOCK I/O     PIDS
ad33ab277600   test-01   0.00%     540KiB / 300MiB     0.18%     648B / 0B   0B / 0B       1
f86590ceb190   test      0.00%     6.344MiB / 300MiB   2.11%     648B / 0B   26.4MB / 0B   2

[root@docker-01 ~]# docker inspect test | grep  -i mem
            "Memory": 314572800,
            "CpusetMems": "",
            "MemoryReservation": 0,
            "MemorySwap": 314572800,
            "MemorySwappiness": null,

[root@docker-01 ~]# docker inspect test-01 | grep  -i mem
            "Memory": 314572800,
            "CpusetMems": "",
            "MemoryReservation": 0,
            "MemorySwap": 314572800,
            "MemorySwappiness": null,

 设置容器不被kill

  • 容器在运行中,如果内存使用超出最大限制后,docker会将容器杀死,但是容器中有些服务会很重要,不能被杀死
[root@docker-01 ~]# docker run -dit --name test --memory 256m --memory-swap 256m --no-healthcheck=false nginx:latest 
0ea31b515ca8dbb3fcf4976647ec9761198d4f432be98f5ef4ce8bb417c4c4ac

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS         PORTS     NAMES
0ea31b515ca8   nginx:latest   "/docker-entrypoint.…"   7 seconds ago   Up 6 seconds   80/tcp    test

[root@docker-01 ~]# docker stats --no-stream 
CONTAINER ID   NAME      CPU %     MEM USAGE / LIMIT   MEM %     NET I/O     BLOCK I/O   PIDS
0ea31b515ca8   test      0.00%     1.797MiB / 256MiB   0.70%     648B / 0B   0B / 0B     2

容器内存扩容 

[root@docker-01 ~]# docker inspect test-01 | grep -i mem
            "Memory": 268435456,
            "CpusetMems": "",
            "MemoryReservation": 0,
            "MemorySwap": 268435456,
            "MemorySwappiness": null,

[root@docker-01 ~]# docker update --memory 512m --memory-swap 512m test-01 
test-01

[root@docker-01 ~]# docker stats --no-stream 
CONTAINER ID   NAME      CPU %     MEM USAGE / LIMIT   MEM %     NET I/O     BLOCK I/O   PIDS
835765b53151   test-01   0.00%     1.801MiB / 512MiB   0.35%     648B / 0B   0B / 0B     2
[root@docker-01 ~]# docker inspect test-01 | grep -i mem
            "Memory": 536870912,
            "CpusetMems": "",
            "MemoryReservation": 0,
            "MemorySwap": 536870912,
            "MemorySwappiness": null,

 容器只可以在cpu0上运行

[root@docker-01 ~]# docker run -dit --name test --memory 256m --memory-swap 256m --cpuset-cpus 0 nginx:latest 
5f4ea4c54fba032131d8df05d3f47d28d88054882ad174ab092166632d2467e2
[root@docker-01 ~]# docker stats --no-stream 
CONTAINER ID   NAME      CPU %     MEM USAGE / LIMIT   MEM %     NET I/O     BLOCK I/O   PIDS
5f4ea4c54fba   test      0.00%     1.801MiB / 256MiB   0.70%     648B / 0B   0B / 0B     2

 容器可以在cpu0-cpu1之间运行

[root@docker-01 ~]# docker run -dit --name test --memory 256m --memory-swap 256m --cpuset-cpus '0-1' nginx:latest

  容器只可以在cpu0、cpu1运行

[root@docker-01 ~]# docker run -dit --name test-02 --memory 256m --memory-swap 256m --cpuset-cpus '0,1' nginx:latest

 容器只能使用50%的CPU资源

[root@docker-01 ~]# docker run -dit --name test-01 --memory 256m --memory-swap 256m --cpuset-cpus 0 --cpu-shares 50 nginx:latest 
835765b53151d23cadc688aee2d69e373cf7ab4fe1931600b35e0e55b2cb9695

[root@docker-01 ~]# docker inspect test-01 | grep -i cpu
            "CpuShares": 50,
            "NanoCpus": 0,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "0",
            "CpusetMems": "",
            "CpuCount": 0,
            "CpuPercent": 0,

 容器重命名 - rename

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED              STATUS              PORTS     NAMES
a5ff63d7068d   nginx:latest   "/docker-entrypoint.…"   About a minute ago   Up About a minute   80/tcp    romantic_shtern
[root@docker-01 ~]# docker rename a5ff63d7068d nginx
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED              STATUS              PORTS     NAMES
a5ff63d7068d   nginx:latest   "/docker-entrypoint.…"   About a minute ago   Up About a minute   80/tcp    nginx
[root@docker-01 ~]# 

 进入容器、attach命令退出会容器停止 - attach

[root@docker-01 ~]# docker attach 4f2dd90101d7
/ # ls
bin    dev    etc    home   lib    media  mnt    opt    proc   root   run    sbin   srv    sys    tmp    usr    var
/ # exit
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED              STATUS                     PORTS     NAMES
4f2dd90101d7   alpine:latest   "/bin/sh"                31 seconds ago       Exited (0) 2 seconds ago             practical_poincare

 

  • 但是我们使用attach进入容器后,想退出但是不想容器死掉,使用 crtl + p + q,偷偷退出
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND     CREATED         STATUS         PORTS     NAMES
d6e4f2cdbdb7   alpine:latest   "/bin/sh"   8 seconds ago   Up 7 seconds             jovial_meninsky
[root@docker-01 ~]# docker attach d6e4f2cdbdb7
/ # ls
bin    dev    etc    home   lib    media  mnt    opt    proc   root   run    sbin   srv    sys    tmp    usr    var
/ # read escape sequence
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND     CREATED          STATUS          PORTS     NAMES
d6e4f2cdbdb7   alpine:latest   "/bin/sh"   27 seconds ago   Up 27 seconds             jovial_meninsky
[root@docker-01 ~]# 

 

  • 有意思的是:使用attach命令,不管是多少人进入这个容器,都是用的相同的终端下工作,所以说画面都是是同步的,执行的过程大家都能看到,当如果有人执行了exit,自己也会退出容器也会死掉

 进入容器exec,退出容器不会停止 - exec

[root@docker-01 ~]# docker exec -it jovial_meninsky /bin/sh
/ # ls
bin    dev    etc    home   lib    media  mnt    opt    proc   root   run    sbin   srv    sys    test   tmp    usr    var
/ # exit
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND     CREATED         STATUS          PORTS     NAMES
d6e4f2cdbdb7   alpine:latest   "/bin/sh"   6 minutes ago   Up 20 seconds             jovial_meninsky

 那么使用exec进入的容器为什么退出时容器不会死掉?他和attach有什么区别?

  • 1、exec 进入容器时需要指定方式/bin/sh,也就是说会在进入容器时生成新的终端并在此终端下作业,所以说不管多少人使用exec进入相同的容器,都不会是同一个终端,并不会影响其他人在容器中的作业

 查看启动、运行中的容器 - ps

[root@docker-01 ~]# docker ps
CONTAINER ID   IMAGE           COMMAND     CREATED          STATUS          PORTS     NAMES
d6e4f2cdbdb7   alpine:latest   "/bin/sh"   14 minutes ago   Up 22 seconds             jovial_meninsky

# 或使用 container ls
[root@docker-01 ~]# docker container ls
CONTAINER ID   IMAGE           COMMAND     CREATED          STATUS          PORTS     NAMES
d6e4f2cdbdb7   alpine:latest   "/bin/sh"   14 minutes ago   Up 39 seconds             jovial_meninsky

 查看所有容器 - ps -a

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED          STATUS              PORTS     NAMES
4cc6e2bd2878   nginx:latest    "/docker-entrypoint.…"   30 seconds ago   Created                       boring_hoover
d6e4f2cdbdb7   alpine:latest   "/bin/sh"                16 minutes ago   Up About a minute             jovial_meninsky
[root@docker-01 ~]#

 查看最新创建的容器

[root@docker-01 ~]# docker ps -a -l
CONTAINER ID   IMAGE          COMMAND                  CREATED              STATUS    PORTS     NAMES
4cc6e2bd2878   nginx:latest   "/docker-entrypoint.…"   About a minute ago   Created             boring_hoover

 删除容器 - rm(只能删除停止的容器)

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED         STATUS         PORTS     NAMES
546bc01de58e   alpine:latest   "/bin/sh"                2 minutes ago   Up 6 seconds             pedantic_morse
4ff3ae3ab2b7   nginx:latest    "/docker-entrypoint.…"   3 minutes ago   Up 6 seconds   80/tcp    musing_jackson
[root@docker-01 ~]# docker stop 546bc01de58e
546bc01de58e

[root@docker-01 ~]# docker rm pedantic_morse 
pedantic_morse
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS          PORTS     NAMES
4ff3ae3ab2b7   nginx:latest   "/docker-entrypoint.…"   3 minutes ago   Up 36 seconds   80/tcp    musing_jackson
[root@docker-01 ~]# 

 强制删除正在运行中的容器 - f

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS          PORTS     NAMES
4ff3ae3ab2b7   nginx:latest   "/docker-entrypoint.…"   6 minutes ago   Up 46 seconds   80/tcp    musing_jackson
[root@docker-01 ~]# docker rm -f musing_jackson 
musing_jackson
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@docker-01 ~]#

 批量删除容器 - rm(rm:只能删除停止的容器 ,-f :删除所有,包含运行中的容器)

[root@docker-01 ~]# docker rm -f $(docker ps -aq)
4cc6e2bd2878
d6e4f2cdbdb7

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

 删除已经停止的容器

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED          STATUS                     PORTS     NAMES
796a3ad06ca9   nginx:latest   "/docker-entrypoint.…"   22 seconds ago   Exited (0) 9 seconds ago             test-01
cccbebdc927e   nginx:latest   "/docker-entrypoint.…"   27 seconds ago   Up 26 seconds              80/tcp    test-02
61b7b8736291   nginx:latest   "/docker-entrypoint.…"   33 seconds ago   Exited (0) 2 seconds ago             test-04
d4ef395e0e5e   nginx:latest   "/docker-entrypoint.…"   36 seconds ago   Up 36 seconds              80/tcp    test-03

[root@docker-01 ~]# docker ps -a | grep Exit | awk '{print $NF}' | xargs docker rm
test-01
test-04
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS         PORTS     NAMES
cccbebdc927e   nginx:latest   "/docker-entrypoint.…"   2 minutes ago   Up 2 minutes   80/tcp    test-02
d4ef395e0e5e   nginx:latest   "/docker-entrypoint.…"   2 minutes ago   Up 2 minutes   80/tcp    test-03

停止容器 - stop

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS              PORTS     NAMES
4ff3ae3ab2b7   nginx:latest   "/docker-entrypoint.…"   4 minutes ago   Up About a minute   80/tcp    musing_jackson
[root@docker-01 ~]# docker stop 4ff3ae3ab2b7
4ff3ae3ab2b7
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS                     PORTS     NAMES
4ff3ae3ab2b7   nginx:latest   "/docker-entrypoint.…"   5 minutes ago   Exited (0) 4 seconds ago             musing_jackson
[root@docker-01 ~]# 

 批量停止容器

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED         STATUS         PORTS     NAMES
546bc01de58e   alpine:latest   "/bin/sh"                3 seconds ago   Up 3 seconds             pedantic_morse
4ff3ae3ab2b7   nginx:latest    "/docker-entrypoint.…"   8 seconds ago   Up 7 seconds   80/tcp    musing_jackson
[root@docker-01 ~]# docker stop $(docker ps -aq)
546bc01de58e
4ff3ae3ab2b7
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED          STATUS                       PORTS     NAMES
546bc01de58e   alpine:latest   "/bin/sh"                29 seconds ago   Exited (137) 4 seconds ago             pedantic_morse
4ff3ae3ab2b7   nginx:latest    "/docker-entrypoint.…"   34 seconds ago   Exited (0) 14 seconds ago              musing_jackson
[root@docker-01 ~]# 

 我们发现使用stop停止容器,过程会很慢,可以使用kill强制停止

[root@docker-01 ~]# docker kill $(docker ps -aq)
546bc01de58e
4ff3ae3ab2b7
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE           COMMAND                  CREATED              STATUS                       PORTS     NAMES
546bc01de58e   alpine:latest   "/bin/sh"                About a minute ago   Exited (137) 3 seconds ago             pedantic_morse
4ff3ae3ab2b7   nginx:latest    "/docker-entrypoint.…"   2 minutes ago        Exited (137) 3 seconds ago             musing_jackson
[root@docker-01 ~]# 

 重启容器 - restart

[root@docker-01 ~]# docker restart musing_jackson 
musing_jackson
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS         PORTS     NAMES
4ff3ae3ab2b7   nginx:latest   "/docker-entrypoint.…"   5 minutes ago   Up 2 seconds   80/tcp    musing_jackson
[root@docker-01 ~]# 

 查看容器中使用的系统

[root@docker-01 ~]# docker run -dit alpine:latest 
6f422cf9500c53f10f12119a2706b8faf33303947ec9aea8dbf6428c81e8c77d
[root@docker-01 ~]# docker exec trusting_engelbart cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.18.2
PRETTY_NAME="Alpine Linux v3.18"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
[root@docker-01 ~]# 

将更改过的容器提交为一个新的镜像 - commit

[root@docker-01 ~]# docker exec -it cool_mendeleev /bin/bash
[root@cd3eb28ffbd0 /]# cat > /etc/yum.repos.d/nginx.repo << OK
> [nginx-stable]
> name=nginx stable repo
> baseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/
> gpgcheck=0
> enabled=1
> gpgkey=https://nginx.org/keys/nginx_signing.key
> module_hotfixes=true
> OK
[root@cd3eb28ffbd0 /]# yum -y install nginx
[root@a121db69daff /]# nginx
[root@cd3eb28ffbd0 /]# exit
exit

[root@docker-01 ~]# docker commit cool_mendeleev nginx/centos:7
sha256:daa47d59f276ad84e8a0e09547f2958f62e7bf15431850f64d5e7d3bbdb6495d
[root@docker-01 ~]# docker images
REPOSITORY     TAG       IMAGE ID       CREATED         SIZE
nginx/centos   7         daa47d59f276   3 seconds ago   458MB
nginx          latest    021283c8eb95   12 days ago     187MB
alpine         latest    c1aabb73d233   4 weeks ago     7.33MB
centos         7         eeb6ee3f44bd   22 months ago   204MB
centos         latest    5d0da3dc9764   22 months ago   231MB

[root@docker-01 ~]# docker run -dit -p 80:80 nginx/centos:7 
a121db69daff2260798d732c2ad37aa9c0cbb5a444e1c62d6aa03ec0950d3306
[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE            COMMAND       CREATED         STATUS         PORTS                               NAMES
a121db69daff   nginx/centos:7   "/bin/bash"   3 seconds ago   Up 2 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp   objective_ptolemy
cd3eb28ffbd0   centos:7         "/bin/bash"   3 minutes ago   Up 3 minutes  

在容器和宿主机中互相复制文件 - cp

[root@docker-01 ~]# touch test
[root@docker-01 ~]# mkdir dir

[root@docker-01 ~]# docker cp test objective_ptolemy:/root
Successfully copied 1.54kB to objective_ptolemy:/root
[root@docker-01 ~]# docker cp dir objective_ptolemy:/root
Successfully copied 1.54kB to objective_ptolemy:/root

[root@docker-01 ~]# docker exec -it a121db69daff /bin/bash
[root@a121db69daff /]# cd root/
[root@a121db69daff ~]# ls
anaconda-ks.cfg  dir  test

 查看容器和镜像是否进行改变 - diff

[root@docker-01 ~]# docker diff objective_ptolemy 
C /var
C /var/log
C /var/log/nginx
C /var/log/nginx/access.log
C /var/log/nginx/error.log
C /var/cache
C /var/cache/nginx
A /var/cache/nginx/client_temp
A /var/cache/nginx/fastcgi_temp
A /var/cache/nginx/proxy_temp
A /var/cache/nginx/scgi_temp
A /var/cache/nginx/uwsgi_temp
C /run
A /run/nginx.pid
C /root
A /root/test
A /root/dir
A /root/llll
C /root/.bash_history

 监控容器 - events

[root@docker-01 ~]# docker events
2023-07-17T23:24:20.956090809+08:00 container exec_die a121db69daff2260798d732c2ad37aa9c0cbb5a444e1c62d6aa03ec0950d3306 (execID=c83af3df8e9971ef24f8edc266a21096a4e5e6c6aabb65efae559e653bb48716, exitCode=0, image=nginx/centos:7, name=objective_ptolemy, org.label-schema.build-date=20201113, org.label-schema.license=GPLv2, org.label-schema.name=CentOS Base Image, org.label-schema.schema-version=1.0, org.label-schema.vendor=CentOS, org.opencontainers.image.created=2020-11-13 00:00:00+00:00, org.opencontainers.image.licenses=GPL-2.0-only, org.opencontainers.image.title=CentOS Base Image, org.opencontainers.image.vendor=CentOS)

将容器进程的文件导出到本地 - export

[root@docker-01 ~]# docker ps -a
CONTAINER ID   IMAGE            COMMAND       CREATED          STATUS          PORTS                               NAMES
a121db69daff   nginx/centos:7   "/bin/bash"   11 minutes ago   Up 11 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp   objective_ptolemy
cd3eb28ffbd0   centos:7         "/bin/bash"   15 minutes ago   Up 15 minutes                                       cool_mendeleev
[root@docker-01 ~]# docker export cd3eb28ffbd0 > test.tar
[root@docker-01 ~]# ls
anaconda-ks.cfg  test.tar

将export导出的文件,创建一个镜像 - import

[root@docker-01 ~]# docker import test.tar centos:7.1
sha256:783d6a9fa04516bb4cb1c781413c916f55781576e53f6ef83a8b365c94c8b4de
[root@docker-01 ~]# docker images
REPOSITORY     TAG       IMAGE ID       CREATED          SIZE
centos         7.1       783d6a9fa045   3 seconds ago    431MB

 查看容器的资源使用情况 - stats

[root@docker-01 ~]# docker stats a121db69daff

CONTAINER ID   NAME                CPU %     MEM USAGE / LIMIT    MEM %     NET I/O           BLOCK I/O     PIDS
a121db69daff   objective_ptolemy   0.00%     2.93MiB / 1.781GiB   0.16%     2.71kB / 2.29kB   3.96MB / 0B   3

[root@docker-01 ~]# docker stats --no-stream 
CONTAINER ID   NAME                CPU %     MEM USAGE / LIMIT     MEM %     NET I/O          BLOCK I/O         PIDS
a121db69daff   objective_ptolemy   0.00%     396KiB / 1GiB         0.04%     648B / 0B        0B / 0B           1
cd3eb28ffbd0   cool_mendeleev      0.00%     64.07MiB / 1.781GiB   3.51%     58.5MB / 233kB   16.3MB / 9.65MB   1

 查看容器日志 - logs

[root@docker-01 ~]# docker logs cool_mendeleev

  查看容器进程 - top

[root@docker-01 ~]# docker top objective_ptolemy 
UID                 PID                 PPID                C                   STIME               TTY                 TIME                CMD
root                21989               21968               0                   23:17               ?                   00:00:00            /bin/bash
root                22115               21968               0                   23:18               ?                   00:00:00            nginx: master process nginx
systemd+            22116               22115               0                   23:18               ?                   00:00:00            nginx: worker process

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/764507.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

(中等)LeetCode146 LRU 缓存 Java

本题有两种实现操作&#xff0c;需要使用到一个哈希表和一个双向链表。在Java语言中&#xff0c;有一种结合了哈希表和双向链表的数据结构&#xff0c;LinkedHashMap import java.util.LinkedHashMap; import java.util.Map;class LRUCache extends LinkedHashMap<Integer,…

网络运维能转型到系统运维吗?

很多网工处于刚起步的初级阶段&#xff0c;各大公司有此专职&#xff0c;但重视或重要程度不高&#xff0c;可替代性强&#xff1b;小公司更多是由其它岗位来兼顾做这一块工作&#xff0c;没有专职&#xff0c;也不可能做得深入。 现在开始学习入门会有一些困难&#xff0c;不…

【深度学习】日常笔记13

前向传播&#xff08;forward propagation或forward pass&#xff09;指的是&#xff1a;按顺序&#xff08;从输⼊层到输出层&#xff09;计算和存储神经⽹络中每层的结果。 绘制计算图有助于我们可视化计算中操作符和变量的依赖关系。下图是与上述简单⽹络相对应的计算图&…

【C语言】深入了解分支和循环语句

&#x1f341; 博客主页:江池俊的博客 &#x1f341;收录专栏&#xff1a;C语言——探索高效编程的基石 &#x1f341; 如果觉得博主的文章还不错的话&#xff0c;请点赞&#x1f44d;收藏&#x1f31f; 三连支持一下博主&#x1f49e; &#x1f4ab;“每一天都是一个全新的机会…

【优选算法题练习】day7

文章目录 一、35. 搜索插入位置1.题目简介2.解题思路3.代码4.运行结果 二、69. x 的平方根1.题目简介2.解题思路3.代码4.运行结果 三、852. 山脉数组的峰顶索引1.题目简介2.解题思路3.代码4.运行结果 总结 一、35. 搜索插入位置 1.题目简介 35. 搜索插入位置 给定一个排序数组…

浅谈自动化测试工具 Appium

目录 前言&#xff1a; 一、简单介绍 &#xff08;一&#xff09;测试对象 &#xff08;二&#xff09;支持平台及语言 &#xff08;三&#xff09;工作原理 &#xff08;四&#xff09;安装工具 二、环境搭建 &#xff08;一&#xff09;安装 Android SDK &#xff0…

08 - 线性表的类型定义 - 循环双向链表

双向链表可以分为普通双向链表(前面我们已经学习过了)与循环双向链表。 循环双向链表的定义 循环双向链表就是在双向链表的基础之上,头结点的Prev指向尾结点,尾结点的Next指针则指向头结点,从而形成闭环结构。 内存中的结构 双向链表与循环双向链表的区别 双向链表 …

Vue项目中你是如何解决跨域的呢?

一、跨域是什么 跨域本质是浏览器基于同源策略的一种安全手段 同源策略&#xff08;Sameoriginpolicy&#xff09;&#xff0c;是一种约定&#xff0c;它是浏览器最核心也最基本的安全功能 所谓同源&#xff08;即指在同一个域&#xff09;具有以下三个相同点 协议相同&…

微信小程序开发入门指南

微信小程序商城是一种方便快捷的电商平台&#xff0c;让商家能够在微信平台上展示和销售自己的商品。本文将详细介绍如何使用乔拓云平台创建自己的小程序商城。即使是对编程没有任何基础的小白用户&#xff0c;也可以轻松创建自己的微信小程序商城。 第一步&#xff0c;登录乔拓…

上门服务小程序|上门家政小程序开发

随着现代生活节奏的加快和人们对便利性的追求&#xff0c;上门家政服务逐渐成为了许多家庭的首选。然而&#xff0c;传统的家政服务存在着信息不透明、服务质量不稳定等问题&#xff0c;给用户带来了困扰。为了解决这些问题&#xff0c;上门家政小程序应运而生。上门家政小程序…

拓数派荣获 “2023 年杭州市企业高新技术研究开发中心” 认定

近日&#xff0c;拓数派上榜由杭州市科学技术局公布的 “2023 年杭州市企业高新技术研究开发中心名单”&#xff0c;通过专业的技术研发、成果转化和高新技术产业化成绩&#xff0c;获得 “杭州市拓数派数据计算企业高新技术研究开发中心” 认定。 图为&#xff1a;“杭州市拓数…

spring boot 多模块项目非启动模块的bean无法注入(问题记录)

之前有说我搭了一个多模块项目&#xff0c;往微服务升级&#xff0c;注入的依赖在zuodou-bean模块中&#xff0c;入jwt拦截&#xff0c; Knife4j ,分页插件等等&#xff0c;但是启动类在system中&#xff0c;看网上说在启动类上加SpringBootApplication注解默认扫描范围为自己…

【HTML】:超文本标记语言的基础入门元素

目录 1️⃣前言2️⃣概述&#x1f331;什么是HTML&#xff1f;&#x1f331;初步认识HTML 3️⃣了解概念✨基本结构✔️元素&#x1f50b; 标签&#x1f4a1;属性 4️⃣基本内容学习标签特殊字符属性图像标签的属性超链接标签的属性 5️⃣锚点链接6️⃣表格表格标签表格标签的属…

(ceph)资源池poll管理

资源池 Pool 管理 前面的文章中我们已经完成了 Ceph 集群的部署&#xff08;ceph部署: 传送门&#xff09;&#xff0c;但是我们如何向 Ceph 中存储数据呢&#xff1f;首先我们需要在 Ceph 中定义一个 Pool 资源池。Pool 是 Ceph 中存储 Object 对象抽象概念。我们可以将其理解…

oracle 如何连同空表一起导出成dmp的方法

1、oracle导出dmp文件的时候&#xff0c;经常会出现一些空表&#xff0c;没有一并被导出的情况。 执行sql select alter table ||table_name|| allocate extent; from user_tables where num_rows0 or num_rows is null; 新建一个sql窗口&#xff0c;把查询结果的sql&#…

MySQL-DQL-案例

案例 案例1 根据需求完成员工管理的条件分页查询 具体代码 -- 案例1&#xff1a;按需求完成员工管理的条件分页查询 - 根据输入条件&#xff0c;查询第一页数据&#xff0c;每页展示10条记录 -- 输入条件&#xff1a; -- 姓名&#xff1a;张 -- 性别&#xff1a;男 -- 入职时间…

深入解析5G承载网:驱动下一代通信技术的支柱

移动通信技术的不断演进&#xff0c;使得5G承载网成为驱动下一代通信技术发展的关键组成部分。在这个数字化时代&#xff0c;了解5G承载网的作用和特点对于理解现代通信网络的架构至关重要。 1.5G承载网的组成和功能 5G承载网由核心网和边缘计算组成。 其中&#xff0c;核心网…

Python实现HBA混合蝙蝠智能算法优化循环神经网络分类模型(LSTM分类算法)项目实战

说明&#xff1a;这是一个机器学习实战项目&#xff08;附带数据代码文档视频讲解&#xff09;&#xff0c;如需数据代码文档视频讲解可以直接到文章最后获取。 1.项目背景 蝙蝠算法是2010年杨教授基于群体智能提出的启发式搜索算法&#xff0c;是一种搜索全局最优解的有效方法…

一款好用的被动式信息泄漏检测插件

插件介绍 FindSomething由陌陌安全残笑老哥开发的浏览器扩展&#xff0c;是一款优秀的被动式信息收集工具&#xff0c;用于展示浏览器打开的页面相关的网站资产和敏感信息。 关注【Hack分享吧】公众号&#xff0c;回复关键字【230629】获取下载链接 支持收集的信息类型如下&am…

瑞吉外卖总结

瑞吉外卖总结笔记 环境 SpringBoot、Mybatis-Plus 注意&#xff1a;使用Mybatis-Plus时&#xff0c;属性值要与数据库中的列名一致 静态映射 当将使用SpringBoot整合前端html项目时&#xff0c;需要使用静态资源的映射&#xff0c;否则会出现html页面部分效果无法展示 解…