Docker 笔记(三)--容器
Docker 笔记(三)–容器
记录Docker 安装操作记录,便于查询。
参考
- 链接: Docker 入门到实战教程(三)镜像和容器
- 链接: docker run中的-itd参数正确使用
- 链接: docker官方文档
- 链接: 阿里云Debian 镜像
- 链接: Debian 全球镜像站
- 链接: Debian/Ubuntu安装ps,ping,telnet,netstat命令
环境
Centos 7.9
操作
1.启动容器
[root@centos7-18 docker]# docker run -it hello-worldHello from Docker!
This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a new container from that image which runs theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto your terminal.To try something more ambitious, you can run an Ubuntu container with:$ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:https://hub.docker.com/For more examples and ideas, visit:https://docs.docker.com/get-started/
- -i: 交互式操作。
- -t: 终端。
- hello-world: 镜像名。
2.查看容器
[root@centos7-18 docker]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3cb195bb73d redis "docker-entrypoint.s…" About a minute ago Exited (0) 47 seconds ago goofy_cohen
075affeee29d nginx "/docker-entrypoint.…" 2 minutes ago Exited (0) 2 minutes ago adoring_ride
40da8fbb8f46 hello-world "/hello" 7 minutes ago Exited (0) 7 minutes ago boring_neumann
[root@centos7-18 docker]#
- STATUS 显示容器的运行状态。 注意!停止运行的容器并不会销毁,如果需要容器停止时销毁可以使用–rm 参数.
3.重启容器
[root@centos7-18 docker]# docker restart f3cb195bb73d
f3cb195bb73d
[root@centos7-18 docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3cb195bb73d redis "docker-entrypoint.s…" 18 minutes ago Up 10 minutes 6379/tcp goofy_cohen
[root@centos7-18 docker]#
4.后台运行
[root@centos7-18 docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 605c77e624dd 22 months ago 141MB
redis latest 7614ae9453d1 23 months ago 113MB
hello-world latest feb5d9fea6a5 2 years ago 13.3kB
[root@centos7-18 docker]#
[root@centos7-18 docker]# docker run -itd --name nginx-demo nginx:latest
74901d661a79a3116d49f6867d5a8e682feb7c9934482ada35a8bd78f01ff35b
- -d 后台运行
- –name 容器别名
- nginx:latest 镜像名称:TAG
[root@centos7-18 docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
74901d661a79 nginx:latest "/docker-entrypoint.…" 16 seconds ago Up 14 seconds 80/tcp nginx-demo
f3cb195bb73d redis "docker-entrypoint.s…" 30 minutes ago Up 23 minutes 6379/tcp goofy_cohen
[root@centos7-18 docker]#
5.停止运行
[root@centos7-18 docker]# docker stop f3cb195bb73d
f3cb195bb73d
[root@centos7-18 docker]# docker ps
6.进入容器
6.1 进入容器
- docker exec -it “容器ID”或“容器名称”,可以使用容器ID或容器名称进入容器
[root@centos7-18 docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
74901d661a79 nginx:latest "/docker-entrypoint.…" 24 minutes ago Up 24 minutes 80/tcp nginx-demo
f3cb195bb73d redis "docker-entrypoint.s…" 55 minutes ago Up 10 minutes 6379/tcp goofy_cohen
[root@centos7-18 docker]# docker exec -it f3cb195bb73d /bin/bash
root@f3cb195bb73d:/data#
[root@centos7-18 docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
74901d661a79 nginx:latest "/docker-entrypoint.…" 27 minutes ago Up 27 minutes 80/tcp nginx-demo
f3cb195bb73d redis "docker-entrypoint.s…" 57 minutes ago Up 13 minutes 6379/tcp goofy_cohen
[root@centos7-18 docker]# docker exec -it nginx-demo /bin/bash
root@74901d661a79:/#
6.2 查看信息
[root@centos7-18 ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
19f2fc32fc60 605c77e624dd "/docker-entrypoint.…" 16 minutes ago Up 16 minutes 80/tcp charming_thompson
[root@centos7-18 ~]# docker exec -it 19f2fc32fc60 /bin/bash
root@19f2fc32fc60:/# uname -a
Linux 19f2fc32fc60 3.10.0-1160.6.1.el7.x86_64 #1 SMP Tue Nov 17 13:59:11 UTC 2020 x86_64 GNU/Linux
root@19f2fc32fc60:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@19f2fc32fc60:/#
6.3 换debian源
- 查看当前源
root@19f2fc32fc60:/etc/apt# cat /etc/apt/sources.list
# deb http://snapshot.debian.org/archive/debian/20211220T000000Z bullseye main
deb http://deb.debian.org/debian bullseye main
# deb http://snapshot.debian.org/archive/debian-security/20211220T000000Z bullseye-security main
deb http://security.debian.org/debian-security bullseye-security main
# deb http://snapshot.debian.org/archive/debian/20211220T000000Z bullseye-updates main
deb http://deb.debian.org/debian bullseye-updates main
root@19f2fc32fc60:/etc/apt#
- 备份sources.list
root@19f2fc32fc60:/etc/apt# cp sources.list sources.list.bak
- 换阿里源
// 清空文件
root@19f2fc32fc60:/etc/apt# echo "">sources.list
root@19f2fc32fc60:/etc/apt# cat sources.list
// 导入阿里源
root@19f2fc32fc60:/etc/apt# cat > sources.list << EOF
> deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
> deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
> deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
> deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
> deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
> deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
> deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
> deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
> EOF
或
root@19f2fc32fc60:/etc/apt# echo "
> deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
> deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
> deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
> deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
> deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
> deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
> deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
> deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
> " > sources.list
// 请缓存,更新
root@19f2fc32fc60:/etc/apt# apt-get clean
root@19f2fc32fc60:/etc/apt# apt-get update
Hit:1 https://mirrors.aliyun.com/debian bullseye InRelease
Get:2 https://mirrors.aliyun.com/debian-security bullseye-security InRelease [48.4 kB]
Get:3 https://mirrors.aliyun.com/debian bullseye-updates InRelease [44.1 kB]
Get:4 https://mirrors.aliyun.com/debian bullseye-backports InRelease [49.0 kB]
Get:5 https://mirrors.aliyun.com/debian-security bullseye-security/main Sources [160 kB]
Get:6 https://mirrors.aliyun.com/debian-security bullseye-security/main amd64 Packages [258 kB]
Get:7 https://mirrors.aliyun.com/debian bullseye-updates/main Sources [7428 B]
Get:8 https://mirrors.aliyun.com/debian bullseye-updates/main amd64 Packages [17.7 kB]
Get:9 https://mirrors.aliyun.com/debian bullseye-backports/non-free Sources [4504 B]
Get:10 https://mirrors.aliyun.com/debian bullseye-backports/contrib Sources [4532 B]
Get:11 https://mirrors.aliyun.com/debian bullseye-backports/main Sources [386 kB]
Get:12 https://mirrors.aliyun.com/debian bullseye-backports/non-free amd64 Packages [13.9 kB]
Get:13 https://mirrors.aliyun.com/debian bullseye-backports/main amd64 Packages [404 kB]
Get:14 https://mirrors.aliyun.com/debian bullseye-backports/contrib amd64 Packages [5968 B]
Fetched 1403 kB in 1s (1170 kB/s)
Reading package lists... Done
6.4 安装包
root@19f2fc32fc60:/etc/apt# apt-get install -y procps vim net-tools inetutils-ping telnet
- procps 进程管理工具 ps top
- vim 文本编辑工具
- net-tools 网络工具 netstat
- inetutils-ping ping
- telnet telnet
6.5 启动服务
- 启动nginx
root@19f2fc32fc60:/etc/nginx# /etc/init.d/nginx start
2023/11/17 04:16:13 [notice] 606#606: using the "epoll" event method
2023/11/17 04:16:13 [notice] 606#606: nginx/1.21.5
2023/11/17 04:16:13 [notice] 606#606: built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
2023/11/17 04:16:13 [notice] 606#606: OS: Linux 3.10.0-1160.6.1.el7.x86_64
2023/11/17 04:16:13 [notice] 606#606: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2023/11/17 04:16:13 [notice] 607#607: start worker processes
2023/11/17 04:16:13 [notice] 607#607: start worker process 608
2023/11/17 04:16:13 [notice] 607#607: start worker process 609
- 查看进程和端口
root@19f2fc32fc60:/etc/nginx# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 04:04 pts/0 00:00:00 /bin/bash
root 7 0 0 04:04 pts/1 00:00:00 bash
root 607 0 0 04:16 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 608 607 0 04:16 ? 00:00:00 nginx: worker process
nginx 609 607 0 04:16 ? 00:00:00 nginx: worker process
root 610 7 0 04:16 pts/1 00:00:00 ps -ef
root@19f2fc32fc60:/etc/nginx# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 607/nginx: master p
root@19f2fc32fc60:/etc/nginx#
7.容器快照
7.1 导出快照
[root@centos7-18 docker]# docker export 74901d661a79 > nginx-demo.tar
[root@centos7-18 docker]# ls
daemon.json nginx-demo.tar
7.2 导入快照
[root@centos7-18 docker]# docker import nginx-demo.tar nginx-demo:1.0
sha256:c2c8866bef605d74ac27fa1f671803139d09f4b9483f7d2312928036323be955
[root@centos7-18 docker]# docker images nginx-demo:1.0
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx-demo 1.0 c2c8866bef60 3 minutes ago 140MB
[root@centos7-18 docker]#
注意!导入的快照是镜像。
8.删除容器
8.1 删除停止的容器
- docker rm “容器ID”
[root@centos7-18 docker]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3cb195bb73d redis "docker-entrypoint.s…" 2 hours ago Up 57 minutes 6379/tcp goofy_cohen
075affeee29d nginx "/docker-entrypoint.…" 2 hours ago Exited (0) 2 hours ago adoring_ride
40da8fbb8f46 hello-world "/hello" 2 hours ago Exited (0) 2 hours ago boring_neumann
[root@centos7-18 docker]# docker rm 40da8fbb8f46
40da8fbb8f46
8.2 强制删除容器
- docker rm -f “容器ID”
[root@centos7-18 docker]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
74901d661a79 nginx:latest "/docker-entrypoint.…" 55 minutes ago Up 55 minutes 80/tcp nginx-demo
f3cb195bb73d redis "docker-entrypoint.s…" About an hour ago Up 41 minutes 6379/tcp goofy_cohen
[root@centos7-18 docker]# docker rm -f 74901d661a79
74901d661a79
8.3 清除所有停止容器
- docker container prune
[root@centos7-18 docker]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d4d7b7b33e22 hello-world "/hello" 31 seconds ago Exited (0) 31 seconds ago quizzical_banach
f3cb195bb73d redis "docker-entrypoint.s…" 2 hours ago Exited (0) 4 seconds ago goofy_cohen
075affeee29d nginx "/docker-entrypoint.…" 2 hours ago Exited (0) 2 hours ago adoring_ride
[root@centos7-18 docker]# docker container prune
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
d4d7b7b33e224d0a757ac2a2dd70ff69bf95bfcf584f0c413d774a1382d98355
f3cb195bb73dfb23a0eca591572b97505d57af5afa9880171836285ea5483b3d
075affeee29db528f9c267f3f8ee6263d9aad39f6da9766a91b39a0b2bf5913dTotal reclaimed space: 1.098kB
[root@centos7-18 docker]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@centos7-18 docker]#
9.容器命令
9.1 查询容器内进程
- docker top “容器ID”
[root@centos7-18 ~]# docker top 19f2fc32fc60
UID PID PPID C STIME TTY TIME CMD
root 21175 21156 0 13:42 pts/0 00:00:00 /bin/bash
root 21224 21156 0 13:42 ? 00:00:00 bash
root 22502 21156 0 13:53 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
101 22503 22502 0 13:53 ? 00:00:00 nginx: worker process
101 22504 22502 0 13:53 ? 00:00:00 nginx: worker process
[root@centos7-18 ~]#
9.2查询容器信息
- docker inspect “容器ID”
[root@centos7-18 ~]# docker inspect 19f2fc32fc60
[{"Id": "19f2fc32fc604c6b827aa7331df97f059fd85f3792e3d7ac1ffe54e0721ec5bd","Created": "2023-11-15T18:24:24.634633348Z","Path": "/docker-entrypoint.sh","Args": ["/bin/bash"],"State": {"Status": "running","Running": true,"Paused": false,"Restarting": false,"OOMKilled": false,"Dead": false,"Pid": 21175,"ExitCode": 0,"Error": "","StartedAt": "2023-11-17T04:04:20.933228283Z","FinishedAt": "2023-11-17T04:04:09.311054875Z"},"Image": "sha256:605c77e624ddb75e6110f997c58876baa13f8754486b461117934b24a9dc3a85","ResolvConfPath": "/var/lib/docker/containers/19f2fc32fc604c6b827aa7331df97f059fd85f3792e3d7ac1ffe54e0721ec5bd/resolv.conf","HostnamePath": "/var/lib/docker/containers/19f2fc32fc604c6b827aa7331df97f059fd85f3792e3d7ac1ffe54e0721ec5bd/hostname","HostsPath": "/var/lib/docker/containers/19f2fc32fc604c6b827aa7331df97f059fd85f3792e3d7ac1ffe54e0721ec5bd/hosts","LogPath": "/var/lib/docker/containers/19f2fc32fc604c6b827aa7331df97f059fd85f3792e3d7ac1ffe54e0721ec5bd/19f2fc32fc604c6b827aa7331df97f059fd85f3792e3d7ac1ffe54e0721ec5bd-json.log","Name": "/charming_thompson","RestartCount": 0,"Driver": "overlay2","Platform": "linux","MountLabel": "","ProcessLabel": "","AppArmorProfile": "","ExecIDs": ["d8e103024ca2b38387871139f75a1f9b6f0f59e47a962c17837192c6b71fbeb2"],"HostConfig": {"Binds": null,"ContainerIDFile": "","LogConfig": {"Type": "json-file","Config": {}},"NetworkMode": "default","PortBindings": {},"RestartPolicy": {"Name": "no","MaximumRetryCount": 0},"AutoRemove": false,"VolumeDriver": "","VolumesFrom": null,"ConsoleSize": [79,204],"CapAdd": null,"CapDrop": null,"CgroupnsMode": "host","Dns": [],"DnsOptions": [],"DnsSearch": [],"ExtraHosts": null,"GroupAdd": null,"IpcMode": "private","Cgroup": "","Links": null,"OomScoreAdj": 0,"PidMode": "","Privileged": false,"PublishAllPorts": false,"ReadonlyRootfs": false,"SecurityOpt": null,"UTSMode": "","UsernsMode": "","ShmSize": 67108864,"Runtime": "runc","Isolation": "","CpuShares": 0,"Memory": 0,"NanoCpus": 0,"CgroupParent": "","BlkioWeight": 0,"BlkioWeightDevice": [],"BlkioDeviceReadBps": [],"BlkioDeviceWriteBps": [],"BlkioDeviceReadIOps": [],"BlkioDeviceWriteIOps": [],"CpuPeriod": 0,"CpuQuota": 0,"CpuRealtimePeriod": 0,"CpuRealtimeRuntime": 0,"CpusetCpus": "","CpusetMems": "","Devices": [],"DeviceCgroupRules": null,"DeviceRequests": null,"MemoryReservation": 0,"MemorySwap": 0,"MemorySwappiness": null,"OomKillDisable": false,"PidsLimit": null,"Ulimits": null,"CpuCount": 0,"CpuPercent": 0,"IOMaximumIOps": 0,"IOMaximumBandwidth": 0,"MaskedPaths": ["/proc/asound","/proc/acpi","/proc/kcore","/proc/keys","/proc/latency_stats","/proc/timer_list","/proc/timer_stats","/proc/sched_debug","/proc/scsi","/sys/firmware","/sys/devices/virtual/powercap"],"ReadonlyPaths": ["/proc/bus","/proc/fs","/proc/irq","/proc/sys","/proc/sysrq-trigger"]},"GraphDriver": {"Data": {"LowerDir": "/var/lib/docker/overlay2/6f4c29ffd5260d59159a5af2d29812b28cbe65eee2a38dce757709851586261d-init/diff:/var/lib/docker/overlay2/fd8c77083cd9b2c0c9bd36ecf8ade515986d4d9cf536abea70ecb0440fed2907/diff:/var/lib/docker/overlay2/8b0be5030647522bf7b1b39db844d8c650bd8133a00ac05b330879de438c0abb/diff:/var/lib/docker/overlay2/563d515cbd4227114e7adeb014737ce26c3238a9e54135141519c5870470a0e0/diff:/var/lib/docker/overlay2/690c4f6a17cb8cf1aabe042511f57c198281895336138ac474117c60a879cc30/diff:/var/lib/docker/overlay2/3de8af079b18dd20b726da9ce7a91836810e1effd694cc39cccfc63925626d2c/diff:/var/lib/docker/overlay2/b04d78c79c57a4b680bf3f66c56a33b683fd632182f630835ec67d3a400ff965/diff","MergedDir": "/var/lib/docker/overlay2/6f4c29ffd5260d59159a5af2d29812b28cbe65eee2a38dce757709851586261d/merged","UpperDir": "/var/lib/docker/overlay2/6f4c29ffd5260d59159a5af2d29812b28cbe65eee2a38dce757709851586261d/diff","WorkDir": "/var/lib/docker/overlay2/6f4c29ffd5260d59159a5af2d29812b28cbe65eee2a38dce757709851586261d/work"},"Name": "overlay2"},"Mounts": [],"Config": {"Hostname": "19f2fc32fc60","Domainname": "","User": "","AttachStdin": false,"AttachStdout": false,"AttachStderr": false,"ExposedPorts": {"80/tcp": {}},"Tty": true,"OpenStdin": true,"StdinOnce": false,"Env": ["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","NGINX_VERSION=1.21.5","NJS_VERSION=0.7.1","PKG_RELEASE=1~bullseye"],"Cmd": ["/bin/bash"],"Image": "605c77e624dd","Volumes": null,"WorkingDir": "","Entrypoint": ["/docker-entrypoint.sh"],"OnBuild": null,"Labels": {"maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"},"StopSignal": "SIGQUIT"},"NetworkSettings": {"Bridge": "","SandboxID": "67599d6da2920c16fdd15cfd5f542d3e042db4b126c861e31e9ab52409560be6","HairpinMode": false,"LinkLocalIPv6Address": "","LinkLocalIPv6PrefixLen": 0,"Ports": {"80/tcp": null},"SandboxKey": "/var/run/docker/netns/67599d6da292","SecondaryIPAddresses": null,"SecondaryIPv6Addresses": null,"EndpointID": "6a6b8ab5da195f7ef44743be09f5514c89382d0815f69e8a5f607656875588d6","Gateway": "172.17.0.1","GlobalIPv6Address": "","GlobalIPv6PrefixLen": 0,"IPAddress": "172.17.0.2","IPPrefixLen": 16,"IPv6Gateway": "","MacAddress": "02:42:ac:11:00:02","Networks": {"bridge": {"IPAMConfig": null,"Links": null,"Aliases": null,"NetworkID": "2aff696bbb5ba0e6590490d461a8cf35c95f47fee567faa6806a07e680edad0b","EndpointID": "6a6b8ab5da195f7ef44743be09f5514c89382d0815f69e8a5f607656875588d6","Gateway": "172.17.0.1","IPAddress": "172.17.0.2","IPPrefixLen": 16,"IPv6Gateway": "","GlobalIPv6Address": "","GlobalIPv6PrefixLen": 0,"MacAddress": "02:42:ac:11:00:02","DriverOpts": null}}}}
]
9.3查询容器日志
- docker logs “容器ID”或“容器名称”
[root@centos7-18 ~]# docker logs 19f2fc32fc60
// 实时日志
[root@centos7-18 ~]# docker logs -f 19f2fc32fc60
// 从某一时间开始的日志
[root@centos7-18 ~]# docker logs -t --since="2023-11-08T10:00:00" 19f2fc32fc60
// 30分钟日志
[root@centos7-18 ~]# docker logs --since 30m 19f2fc32fc60
相关文章:
Docker 笔记(三)--容器
Docker 笔记(三)–容器 记录Docker 安装操作记录,便于查询。 参考 链接: Docker 入门到实战教程(三)镜像和容器链接: docker run中的-itd参数正确使用链接: docker官方文档链接: 阿里云Debian 镜像链接: Debian 全球镜像站链接: Debian/Ub…...

gd32关于IO引脚配置的一些问题
一、gd32f103的PA15问题 1、 #define GPIO_SWJ_NONJTRST_REMAP ((uint32_t)0x00300100U) /*!< full SWJ(JTAG-DP SW-DP),but without NJTRST */ #define GPIO_SWJ_SWDPENABLE_REMAP ((uint32_t)0x00300200U) /*!< JTAG-DP disabled and SW-DP enab…...
QT小记:警告Use multi-arg instead
"Use multi-arg instead" 是一个提示,建议使用 QObject::tr() 函数的多参数版本来处理多个占位符,而不是使用单参数版本。 在 Qt 中,tr() 是用于进行文本翻译(国际化)的函数。它允许你在应用程序中使用多种…...

皮肤性病科专家谭巍主任提出HPV转阴后饮食七点建议
HPV转阴是每一位感染者都期盼的,因为转阴所以健康,只有转为阴性才意味着不具备传染性,从此也不必再害怕将病毒传染给家人的风险,也不必再担忧持续感染而引发的健康风险。总之,HPV转阴是预示感染者恢复健康与否的主要标…...
快速弄懂C++中的智能指针
智能指针是C中的一个对象,它的行为类似于指针,但它提供了自动的内存管理功能。当智能指针超出作用域时(比如说在函数中使用智能指针指向了一个对象,当该函数结束时会自动销毁该对象),它会自动删除其所指向的…...

C#调用C++ dll教程
文章目录 一、创建C dll项目二、C#程序员调用C dll三、C与C#数据类型对应基本数据类型对应表C指针类型与C#类型 在使用C#开发客户端时,有时需要调用C dll,本篇博客来介绍C#程序如何调用C dll。 一、创建C dll项目 首先使用VS2022创建C dll项目…...

计算机毕设 深度学习 大数据 股票预测系统 - python lstm
文章目录 0 前言1 课题意义1.1 股票预测主流方法 2 什么是LSTM2.1 循环神经网络2.1 LSTM诞生 2 如何用LSTM做股票预测2.1 算法构建流程2.2 部分代码 3 实现效果3.1 数据3.2 预测结果项目运行展示开发环境数据获取 最后 0 前言 🔥 这两年开始毕业设计和毕业答辩的要…...

97.qt qml-自定义Table之实现ctrl与shift多选
我们之前实现了:93.qt qml-自定义Table优化(新增:水平拖拽/缩放自适应/选择使能/自定义委托)-CSDN博客 实现选择使能的时候,我们只能一行行去点击选中,非常麻烦,所以本章我们实现ctrl多选与shift多选、 所以在Table控件新增两个属性: 1.实现介绍 ctrl多选实现原理:当我…...

运行软件报错mfc140.dll丢失?分享mfc140.dll丢失的解决方法
小伙伴们,你是否也有过这样的经历:每当碰到诸如" mfc140.dll 丢失 "之类的烦人错误时,你是不是会一头雾水,完全不知道从何下手去解决?不要担心,接下来咱就给你提供这样一篇实用教程,教…...
milvus数据库-连接
Milvus 支持 19530 和 9091 两个端口: 端口 19530 用于 gRPC 和 RESTful API。 这是您使用不同 Milvus SDK 或 HTTP 客户端连接到 Milvus 服务器时的默认端口。 端口 9091 用于 Kubernetes 内的指标收集、pprof 分析和运行状况探测。 它用作管理端口。 1.连接到数…...
ios + vue3 Teleport + inset 兼容性问题
目录 1,问题表现2,解决步骤1,teleport 的问题2,inset 的问题3,teleport 的问题之二 1,问题表现 使用 vue3 的 Teleport 实现的 dialog 弹窗,但是在 ios app 中嵌套的 h5 中无法打开。 直接在io…...
计蒜客T1654 数列分段(C语言实现)
【题目描述】对于给定的一个长度为n的正整数数列ai,现要将其分成连续的若干段,并且每段和不超过m(可以等于m),问最少能将其分成多少段使得满足要求。 【输入格式】第一行包含两个正整数n,m,表示…...

Linux进程——system函数、popen函数
system函数(执行shell 命令) 头文件 #include <stdlib.h> 函数定义 int system(const char * string); 函数说明 system()会调用fork()产生子进程,由子进程来调用/bin/sh-c string来执行参数string字符串所代表的命令,…...

【智能家居】5、主流程设计以及外设框架编写与测试
目录 一、主流程设计 1、工厂模式结构体定义 (1)指令工厂 inputCmd.h (2)外设工厂 controlDevices.h 二、外设框架编写 1、创建外设工厂对象bathroomLight 2、编写相关函数框架 3、将浴室灯相关操作插入外设工厂链表等待被调…...

详解ssh远程登录服务
华子目录 简介概念功能 分类文字接口图形接口 文字接口ssh连接服务器浅浅介绍一下加密技术凯撒加密加密分类对称加密非对称加密非对称加密方法(也叫公钥加密) ssh两大类认证方式:连接加密技术简介密钥解析 ssh工作过程版本协商阶段密钥和算法…...

LangChain 3使用Agent访问Wikipedia和llm-math计算狗的平均年龄
接着前两节的Langchain,继续实现Langchain中的Agent LangChain 实现给动物取名字,LangChain 2模块化prompt template并用streamlit生成网站 实现给动物取名字 代码实现 # 从langchain库中导入模块 from langchain.llms import OpenAI # 从langchain.l…...

wpf devexpress绑定grid到总计和分组统计
此主题描述了如何在gridcontrol中的视图模型和显示定义总计和分组统计 在视图模型中指定统计 1、创建 SummaryItemType 枚举你想要在GridControl中显示的统计类型: public enum SummaryItemType { Max, Count, None } 2、创建一个grid统计描述类 public class S…...

嵌入式 Linux 移植与系统启动方法
1、Linux系统启动与U-Boot 所谓移植就是把程序代码从一种运行环境转移到另一种运行环境。对于内核移植来说,主要是从一种硬件平台转移到另一种硬件平台上运行。 体系结构级别的移植是指在不同体系结构平台上Linux内核的移植,例如,在ARM、MI…...

代码随想录算法训练营|五十六天
回文子串 647. 回文子串 - 力扣(LeetCode) dp含义:表示区间内[i,j]是否有回文子串,有true,没有false。 递推公式:当s[i]和s[j]不相等,false;相等时,情况一,…...

基于django水果蔬菜生鲜销售系统
基于django水果蔬菜生鲜销售系统 摘要 基于Django的水果蔬菜生鲜销售系统是一种利用Django框架开发的电子商务平台,旨在提供高效、便捷的购物体验,同时支持水果蔬菜生鲜产品的在线销售。该系统整合了用户管理、产品管理、购物车、订单管理等核心功能&…...
Cursor实现用excel数据填充word模版的方法
cursor主页:https://www.cursor.com/ 任务目标:把excel格式的数据里的单元格,按照某一个固定模版填充到word中 文章目录 注意事项逐步生成程序1. 确定格式2. 调试程序 注意事项 直接给一个excel文件和最终呈现的word文件的示例,…...
三维GIS开发cesium智慧地铁教程(5)Cesium相机控制
一、环境搭建 <script src"../cesium1.99/Build/Cesium/Cesium.js"></script> <link rel"stylesheet" href"../cesium1.99/Build/Cesium/Widgets/widgets.css"> 关键配置点: 路径验证:确保相对路径.…...
多场景 OkHttpClient 管理器 - Android 网络通信解决方案
下面是一个完整的 Android 实现,展示如何创建和管理多个 OkHttpClient 实例,分别用于长连接、普通 HTTP 请求和文件下载场景。 <?xml version"1.0" encoding"utf-8"?> <LinearLayout xmlns:android"http://schemas…...
【位运算】消失的两个数字(hard)
消失的两个数字(hard) 题⽬描述:解法(位运算):Java 算法代码:更简便代码 题⽬链接:⾯试题 17.19. 消失的两个数字 题⽬描述: 给定⼀个数组,包含从 1 到 N 所有…...
反射获取方法和属性
Java反射获取方法 在Java中,反射(Reflection)是一种强大的机制,允许程序在运行时访问和操作类的内部属性和方法。通过反射,可以动态地创建对象、调用方法、改变属性值,这在很多Java框架中如Spring和Hiberna…...
unix/linux,sudo,其发展历程详细时间线、由来、历史背景
sudo 的诞生和演化,本身就是一部 Unix/Linux 系统管理哲学变迁的微缩史。来,让我们拨开时间的迷雾,一同探寻 sudo 那波澜壮阔(也颇为实用主义)的发展历程。 历史背景:su的时代与困境 ( 20 世纪 70 年代 - 80 年代初) 在 sudo 出现之前,Unix 系统管理员和需要特权操作的…...

EtherNet/IP转DeviceNet协议网关详解
一,设备主要功能 疆鸿智能JH-DVN-EIP本产品是自主研发的一款EtherNet/IP从站功能的通讯网关。该产品主要功能是连接DeviceNet总线和EtherNet/IP网络,本网关连接到EtherNet/IP总线中做为从站使用,连接到DeviceNet总线中做为从站使用。 在自动…...
JDK 17 新特性
#JDK 17 新特性 /**************** 文本块 *****************/ python/scala中早就支持,不稀奇 String json “”" { “name”: “Java”, “version”: 17 } “”"; /**************** Switch 语句 -> 表达式 *****************/ 挺好的ÿ…...

全志A40i android7.1 调试信息打印串口由uart0改为uart3
一,概述 1. 目的 将调试信息打印串口由uart0改为uart3。 2. 版本信息 Uboot版本:2014.07; Kernel版本:Linux-3.10; 二,Uboot 1. sys_config.fex改动 使能uart3(TX:PH00 RX:PH01),并让boo…...

Android 之 kotlin 语言学习笔记三(Kotlin-Java 互操作)
参考官方文档:https://developer.android.google.cn/kotlin/interop?hlzh-cn 一、Java(供 Kotlin 使用) 1、不得使用硬关键字 不要使用 Kotlin 的任何硬关键字作为方法的名称 或字段。允许使用 Kotlin 的软关键字、修饰符关键字和特殊标识…...