Linux下基于Dockerfile构建镜像应用(1)
目录
基于已有容器创建镜像
Dockerfile构建SSHD镜像
构建镜像
测试容器 可以登陆
Dockerfile构建httpd镜像
构建镜像
测试容器
Dockerfile构建nginx镜像
构建镜像
概述:
Docker 镜像是Docker容器技术中的核心,也是应用打包构建发布的标准格式。一个完整的镜像可以支撑多个容器的运行,在Docker的整个使用过程中,进入一个已经定型的容器之后,就可以在容器中进行操作,最常见的操作就是在容器中安装应用服务。
如果想要把已经安装的服务容器进行迁移,就需要把环境以及部署的服务生成新的镜像。
程序打包方式:
- 打包成Tar包
- 打包成rpm包
- 打包成镜像
构建方式
1、基于已有的容器创建镜像
2、基于本地模板创建镜像
3、基于Dockerfile创建镜像
基于已有容器创建镜像
基于现有镜像创建主要使用 docker commit 命令,即把一个容器里面运行的程序以及该程序的运行环境打包起来生成新的镜像。
命令格式:
docker commit [选项] 容器ID/名称 仓库名称:[标签]
常用选项:
- -m 说明信息;
- -a 作者信息;
- -p 生成过程中停止容器的运行。
首先启动一个镜像,在容器里做相应的修改,然后将修改后的容器提交为新的镜像。需要记住该容器的ID号。
[root@localhost ~]# cat centos-7-x86_64.tar.gz |docker import - centos:7
sha256:790d0b6eb9de3d7ba8df7d91a54d236b381f4800ac751205a1fb6b77cc0c7efd
[root@localhost sshd]# docker run -it centos:7 /bin/bash
WARNING: IPv4 forwarding is disabled. Networking will not work.
[root@d80919f3c00c /]# ls
bin dev fastboot lib lost+found mnt proc run srv tmp var
boot etc home lib64 media opt root sbin sys usr
[root@d80919f3c00c /]# touch lifenghai 创建测试文件
[root@d80919f3c00c /]# ls
bin dev fastboot lib lifenghai media opt root sbin sys usr
boot etc home lib64 lost+found mnt proc run srv tmp var
[root@d80919f3c00c /]# exit
exit
[root@localhost sshd]# docker commit -m "crushlinux test images" -a "crushlinux" d80919f3c00c centos7:ddd
该命令的意思是将容器ID为d80919f3c00c 的容器的更改保存为名为"centos7:new"的新镜像,并指定了提交消息为"crushlinux test images",作者为"crushlinux"。
sha256:595d590702ffc0ca7e23f11f552266c924261c5966f7634de96ba7dfe6a547c3
[root@localhost sshd]# docker images centos7:ddd
REPOSITORY TAG IMAGE ID CREATED SIZE
centos7 ddd 595d590702ff 25 seconds ago 589 MB
[root@localhost sshd]# docker run -it centos7:ddd /bin/bash
WARNING: IPv4 forwarding is disabled. Networking will not work.
[root@14ad9a706c54 /]# ls
bin dev fastboot lib lifenghai media opt root sbin sys usr
boot etc home lib64 lost+found mnt proc run srv tmp var
这是一个Docker命令,用于将一个容器的更改保存为新的镜像。具体解释如下:
docker commit
:Docker命令,用于提交容器的更改。-m "crushlinux test images"
:使用-m
参数指定提交的消息,这里是"crushlinux test images"。-a "crushlinux"
:使用-a
参数指定作者,这里是"crushlinux"。d281f905fb30
:容器的ID或名称,表示要提交更改的容器。centos7:new
:新镜像的名称和标签,这里是"centos7:new"。因此,该命令的意思是将容器ID为
d281f905fb30
的容器的更改保存为名为"centos7:new"的新镜像,并指定了提交消息为"crushlinux test images",作者为"crushlinux"。
Dockerfile构建SSHD镜像
关闭防火墙规则
iptables -F
setenforce 0
systemctl stop firewalld修改配置
[root@localhost ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
search localdomain
创建备用目录
[root@localhost ~]# mkdir sshd
获取密钥
[root@localhost ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:6j2zE3PzgNt4sQdpeR0BUSO4NCrtnissqN4xHJZVoLE root@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
| . ... .++o |
| + . + ... |
| E . . o o . |
| o . o . . |
| + oS. o . . |
| o . .= X . . |
| = ... X O |
| o +.o.O + o |
|oo . ...+B . |
+----[SHA256]-----+
拷贝文件
[root@localhost ~]# cp .ssh/id_rsa.pub sshd/
[root@localhost ~]# cd sshd/
[root@localhost ~]# ll
总用量 591996
-rw-------. 1 root root 1415 7月 31 19:02 anaconda-ks.cfg
-rw-r--r--. 1 root root 221692852 7月 17 2020 centos-7-x86_64.tar.gz
-rw-r--r--. 1 root root 238594048 7月 31 14:26 centos-exp
-rw-------. 1 root root 145905152 7月 31 14:36 nginx-images
drwxr-xr-x. 2 root root 47 8月 2 13:57 sshd
导入镜像
[root@localhost ~]# cat centos-7-x86_64.tar.gz |docker import - centos:7
sha256:790d0b6eb9de3d7ba8df7d91a54d236b381f4800ac751205a1fb6b77cc0c7efd
编写Dockerfile文件
[root@localhost sshd]# vim Dockerfile
#基于的基础镜像
FROM centos:7
#镜像作者信息
MAINTAINER Crushlinux <crushlinux@163.com>
#镜像执行的命令
RUN yum -y install openssh-server net-tools openssh-devel lsof telnet
RUN sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
ADD id_rsa.pub /root/.ssh/authorized_keys
#定义时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#开启 22 端口
EXPOSE 22
#启动容器时执行指令
CMD ["/usr/sbin/sshd" , "-D"]
~
~
重启
[root@localhost sshd]# systemctl restart network
[root@localhost sshd]# systemctl restart docker
构建镜像
[root@localhost sshd]# docker build -t sshd:new .Sending build context to Docker daemon 3.584 kBStep 1/9 : FROM centos:7---> 790d0b6eb9deStep 2/9 : MAINTAINER Crushlinux <crushlinux@163.com>---> Using cache---> f5d4ad40d1dfStep 3/9 : RUN yum -y install openssh-server net-tools openssh-devel lsof telnet---> Running in bdb9cc0dfb6cLoaded plugins: fastestmirrorDetermining fastest mirrors* base: mirrors.bfsu.edu.cn* extras: mirrors.ustc.edu.cn* updates: mirrors.ustc.edu.cnNo package openssh-devel available.Resolving Dependencies--> Running transaction check---> Package lsof.x86_64 0:4.87-4.el7 will be updated---> Package lsof.x86_64 0:4.87-6.el7 will be an update---> Package net-tools.x86_64 0:2.0-0.25.20131004git.el7 will be installed---> Package openssh-server.x86_64 0:6.6.1p1-25.el7_2 will be updated---> Package openssh-server.x86_64 0:7.4p1-22.el7_9 will be an update--> Processing Dependency: openssh = 7.4p1-22.el7_9 for package: openssh-server-7.4p1-22.el7_9.x86_64--> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.2)(64bit) for package: openssh-server-7.4p1-22.el7_9.x86_64---> Package telnet.x86_64 1:0.17-59.el7 will be updated---> Package telnet.x86_64 1:0.17-66.el7 will be an update--> Running transaction check---> Package openssh.x86_64 0:6.6.1p1-25.el7_2 will be updated--> Processing Dependency: openssh = 6.6.1p1-25.el7_2 for package: openssh-clients-6.6.1p1-25.el7_2.x86_64---> Package openssh.x86_64 0:7.4p1-22.el7_9 will be an update---> Package openssl-libs.x86_64 1:1.0.1e-51.el7_2.5 will be updated--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-51.el7_2.5 for package: 1:openssl-1.0.1e-51.el7_2.5.x86_64---> Package openssl-libs.x86_64 1:1.0.2k-26.el7_9 will be an update--> Running transaction check---> Package openssh-clients.x86_64 0:6.6.1p1-25.el7_2 will be updated---> Package openssh-clients.x86_64 0:7.4p1-22.el7_9 will be an update---> Package openssl.x86_64 1:1.0.1e-51.el7_2.5 will be updated---> Package openssl.x86_64 1:1.0.2k-26.el7_9 will be an update--> Finished Dependency ResolutionDependencies Resolved================================================================================Package Arch Version Repository Size================================================================================Installing:net-tools x86_64 2.0-0.25.20131004git.el7 base 306 kUpdating:lsof x86_64 4.87-6.el7 base 331 kopenssh-server x86_64 7.4p1-22.el7_9 updates 459 ktelnet x86_64 1:0.17-66.el7 updates 64 kUpdating for dependencies:openssh x86_64 7.4p1-22.el7_9 updates 510 kopenssh-clients x86_64 7.4p1-22.el7_9 updates 655 kopenssl x86_64 1:1.0.2k-26.el7_9 updates 494 kopenssl-libs x86_64 1:1.0.2k-26.el7_9 updates 1.2 MTransaction Summary================================================================================Install 1 PackageUpgrade 3 Packages (+4 Dependent packages)Total download size: 4.0 MDownloading packages:Delta RPMs disabled because /usr/bin/applydeltarpm not installed.warning: /var/cache/yum/x86_64/7/base/packages/lsof-4.87-6.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEYPublic key for lsof-4.87-6.el7.x86_64.rpm is not installedPublic key for openssh-server-7.4p1-22.el7_9.x86_64.rpm is not installedImporting GPG key 0xF4A80EB5:Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5Package : centos-release-7-2.1511.el7.centos.2.10.x86_64 (installed)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7--------------------------------------------------------------------------------Total 622 kB/s | 4.0 MB 00:06 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7Running transaction checkRunning transaction testTransaction test succeededRunning transactionUpdating : 1:openssl-libs-1.0.2k-26.el7_9.x86_64 1/15Updating : openssh-7.4p1-22.el7_9.x86_64 2/15Updating : openssh-server-7.4p1-22.el7_9.x86_64 3/15warning: /etc/ssh/sshd_config created as /etc/ssh/sshd_config.rpmnewUpdating : openssh-clients-7.4p1-22.el7_9.x86_64 4/15Updating : 1:openssl-1.0.2k-26.el7_9.x86_64 5/15Installing : net-tools-2.0-0.25.20131004git.el7.x86_64 6/15Updating : lsof-4.87-6.el7.x86_64 7/15Updating : 1:telnet-0.17-66.el7.x86_64 8/15Cleanup : openssh-clients-6.6.1p1-25.el7_2.x86_64 9/15Cleanup : openssh-server-6.6.1p1-25.el7_2.x86_64 10/15Cleanup : openssh-6.6.1p1-25.el7_2.x86_64 11/15Cleanup : 1:openssl-1.0.1e-51.el7_2.5.x86_64 12/15Cleanup : 1:openssl-libs-1.0.1e-51.el7_2.5.x86_64 13/15Cleanup : lsof-4.87-4.el7.x86_64 14/15Cleanup : 1:telnet-0.17-59.el7.x86_64 15/15Verifying : 1:telnet-0.17-66.el7.x86_64 1/15Verifying : openssh-server-7.4p1-22.el7_9.x86_64 2/15Verifying : 1:openssl-libs-1.0.2k-26.el7_9.x86_64 3/15Verifying : lsof-4.87-6.el7.x86_64 4/15Verifying : net-tools-2.0-0.25.20131004git.el7.x86_64 5/15Verifying : openssh-clients-7.4p1-22.el7_9.x86_64 6/15Verifying : openssh-7.4p1-22.el7_9.x86_64 7/15Verifying : 1:openssl-1.0.2k-26.el7_9.x86_64 8/15Verifying : 1:telnet-0.17-59.el7.x86_64 9/15Verifying : openssh-6.6.1p1-25.el7_2.x86_64 10/15Verifying : 1:openssl-1.0.1e-51.el7_2.5.x86_64 11/15Verifying : openssh-server-6.6.1p1-25.el7_2.x86_64 12/15Verifying : openssh-clients-6.6.1p1-25.el7_2.x86_64 13/15Verifying : lsof-4.87-4.el7.x86_64 14/15Verifying : 1:openssl-libs-1.0.1e-51.el7_2.5.x86_64 15/15Installed:net-tools.x86_64 0:2.0-0.25.20131004git.el7 Updated:lsof.x86_64 0:4.87-6.el7 openssh-server.x86_64 0:7.4p1-22.el7_9 telnet.x86_64 1:0.17-66.el7 Dependency Updated:openssh.x86_64 0:7.4p1-22.el7_9 openssh-clients.x86_64 0:7.4p1-22.el7_9 openssl.x86_64 1:1.0.2k-26.el7_9 openssl-libs.x86_64 1:1.0.2k-26.el7_9 Complete!---> 4d1711b1891cRemoving intermediate container bdb9cc0dfb6cStep 4/9 : RUN sed -i 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config---> Running in c6bcc01f445e---> 20b01ccf2a71Removing intermediate container c6bcc01f445eStep 5/9 : RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key---> Running in 8d573e2d3e45Generating public/private rsa key pair.Your identification has been saved in /etc/ssh/ssh_host_rsa_key.Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.The key fingerprint is:SHA256:Q9t9zoZ4iE/eCmeKuyUqmUt1IRvPo34wrWN5wbo8ypE root@bdb9cc0dfb6cThe key's randomart image is:+---[RSA 2048]----+| || || o . . || * o o . || oo= S . . . || ooo+. o o = || Eo.*..+ * o + || o++B.o+ O o . || +==*+o. +.. |+----[SHA256]-----+Enter passphrase (empty for no passphrase): Enter same passphrase again: ---> 14dd7eb2256fRemoving intermediate container 8d573e2d3e45Step 6/9 : ADD id_rsa.pub /root/.ssh/authorized_keys---> 99984eb1e50eRemoving intermediate container 369022575e01Step 7/9 : RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime---> Running in b0056bbc027e---> 950f0c260a79Removing intermediate container b0056bbc027eStep 8/9 : EXPOSE 22---> Running in 190b29e65718---> c6a476cb31b4Removing intermediate container 190b29e65718Step 9/9 : CMD /usr/sbin/sshd -D---> Running in 0b76956add3a---> a600eb2f7badRemoving intermediate container 0b76956add3aSuccessfully built a600eb2f7bad
测试容器 可以登陆
[root@localhost sshd]# docker images sshd:new
REPOSITORY TAG IMAGE ID CREATED SIZE
sshd new a600eb2f7bad 3 minutes ago 821 MB
[root@localhost sshd]# docker run -d -p 2222:22 --name sshd-test --restart=always sshd:new
61a2bbb409288f6d1e0c95dfe8ef9b732b77bcd35129972700d181fefa08631e
[root@localhost sshd]# ssh localhost -p 2222
The authenticity of host '[localhost]:2222 ([::1]:2222)' can't be established.
RSA key fingerprint is SHA256:Q9t9zoZ4iE/eCmeKuyUqmUt1IRvPo34wrWN5wbo8ypE.
RSA key fingerprint is MD5:1e:97:2c:02:4d:35:1e:3f:68:a0:30:9c:cc:53:a2:cf.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:2222' (RSA) to the list of known hosts.
[root@61a2bbb40928 ~]#
[root@61a2bbb40928 ~]# exit
登出
Connection to localhost closed.
Dockerfile构建httpd镜像
创建工作目录
[root@localhost ~]# mkdir httpd
[root@localhost ~]# cd httpd/
编写Dockerfile文件
[root@localhost httpd]# vim Dockerfile
[root@localhost httpd]# cat Dockerfile
FROM centos:7
MAINTAINER hhh <hhh@163.com>
RUN yum -y install httpd
RUN echo "crushlinux" >/var/www/html/index.html
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
EXPOSE 80
CMD ["httpd","-DFOREGROUND"]
构建镜像
[root@localhost httpd]# docker build -t httpd:new .
Sending build context to Docker daemon 2.048 kB
Step 1/7 : FROM centos:7
---> 790d0b6eb9de
Step 2/7 : MAINTAINER hhh <hhh@163.com>
---> Using cache
---> 25eef094ceba
Step 3/7 : RUN yum -y install httpd
---> Running in 8324e3b4b5c7
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirrors.bfsu.edu.cn
* extras: mirrors.bfsu.edu.cn
* updates: mirrors.bfsu.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-40.el7.centos.1 will be updated
---> Package httpd.x86_64 0:2.4.6-99.el7.centos.1 will be an update
--> Processing Dependency: httpd-tools = 2.4.6-99.el7.centos.1 for package: httpd-2.4.6-99.el7.centos.1.
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-40.el7.centos.1 will be updated
---> Package httpd-tools.x86_64 0:2.4.6-99.el7.centos.1 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
httpd x86_64 2.4.6-99.el7.centos.1 updates 2.7 M
Updating for dependencies:
httpd-tools x86_64 2.4.6-99.el7.centos.1 updates 94 k
Transaction Summary
================================================================================
Upgrade 1 Package (+1 Dependent package)
Total download size: 2.8 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
Public key for httpd-tools-2.4.6-99.el7.centos.1.x86_64.rpm is not installed
warning: /var/cache/yum/x86_64/7/updates/packages/httpd-tools-2.4.6-99.el7.centos.1.x86_64.rpm: Header V
--------------------------------------------------------------------------------
Total 1.6 MB/s | 2.8 MB 00:01
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-2.1511.el7.centos.2.10.x86_64 (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : httpd-tools-2.4.6-99.el7.centos.1.x86_64 1/4
Updating : httpd-2.4.6-99.el7.centos.1.x86_64 2/4
Cleanup : httpd-2.4.6-40.el7.centos.1.x86_64 3/4
Cleanup : httpd-tools-2.4.6-40.el7.centos.1.x86_64 4/4
Verifying : httpd-2.4.6-99.el7.centos.1.x86_64 1/4
Verifying : httpd-tools-2.4.6-99.el7.centos.1.x86_64 2/4
Verifying : httpd-2.4.6-40.el7.centos.1.x86_64 3/4
Verifying : httpd-tools-2.4.6-40.el7.centos.1.x86_64 4/4
Updated:
httpd.x86_64 0:2.4.6-99.el7.centos.1
Dependency Updated:
httpd-tools.x86_64 0:2.4.6-99.el7.centos.1
Complete!
---> 2214fb4006c9
Removing intermediate container 8324e3b4b5c7
Step 4/7 : RUN echo "crushlinux" >/var/www/html/index.html
---> Running in badb364c7e55
---> a9b433c350e4
Removing intermediate container badb364c7e55
Step 5/7 : RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
---> Running in d0081e48aa43
---> ffaf678f3cfc
Removing intermediate container d0081e48aa43
Step 6/7 : EXPOSE 80
---> Running in 3bd620f29826
---> 89d665eda838
Removing intermediate container 3bd620f29826
Step 7/7 : CMD httpd -DFOREGROUND
---> Running in 2dea705ece43
---> 7f5e5dc62d40
Removing intermediate container 2dea705ece43
Successfully built 7f5e5dc62d40
查看
[root@localhost httpd]# docker images httpd
REPOSITORY TAG IMAGE ID CREATED SIZE
httpd new 7f5e5dc62d40 2 minutes ago 819 MB
测试容器
[root@localhost httpd]# docker run -d -p 8080:80 --name httpd-test --restart=always httpd:new
90bc8641fbefdf722c5d5842931d776bcbef0a6766c66f3fbc92d966d5752460
Dockerfile构建nginx镜像
建立工作目录
[root@localhost ~]# mkdir nginx
[root@localhost ~]# cd nginx
编写Dockerfile文件
[root@localhost nginx]# vim run.sh
[root@localhost nginx]# cat run.sh
#!/bin/bash
/usr/local/nginx/sbin/nginx
[root@localhost nginx]# cat Dockerfile
#基于的基础镜像
FROM centos:7
#镜像作者信息
MAINTAINER hhh <hhh@163.com>
#安装相关依赖包
RUN yum install -y wget proc-devel net-tools gcc zlib zlib-devel make openssl-devel
#下载并解压nginx源码包
RUN wget http://nginx.org/download/nginx-1.19.0.tar.gz && tar zxf nginx-1.19.0.tar.gz
#编译安装nginx
RUN cd nginx-1.19.0 && ./configure --prefix=/usr/local/nginx && make && make install
#开启 80 和 443 端口
EXPOSE 80
#修改 Nginx 配置文件,以非 daemon 方式启动
RUN echo "daemon off;">>/usr/local/nginx/conf/nginx.conf
#定义时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
#复制服务启动脚本并设置权限
ADD run.sh /run.sh
RUN chmod 775 /run.sh
#启动容器时执行脚本
CMD ["/run.sh"]
构建镜像
[root@localhost nginx]# docker build -t nginx:new
相关文章:

Linux下基于Dockerfile构建镜像应用(1)
目录 基于已有容器创建镜像 Dockerfile构建SSHD镜像 构建镜像 测试容器 可以登陆 Dockerfile构建httpd镜像 构建镜像 测试容器 Dockerfile构建nginx镜像 构建镜像 概述: Docker 镜像是Docker容器技术中的核心,也是应用打包构建发布的标准格式。…...

JS中常见的模块管理规范梳理
一、CommonJS规范 CommonJS规范是一种用于JavaScript模块化开发的规范,它定义了模块的导入、导出方式和加载机制,主要用在Node开发中。 1. 使用场景 服务器端开发:Node.js是使用CommonJS规范的,因此在服务器端开发中࿰…...

3维空间下按平面和圆柱面上排版设计
AR空间中将若干平面窗口排列在指定平面或圆柱体面上 平面排版思路 指定平面方向向量layout_centre ,平面上的一点作为排版版面的中心layout_position float3 layout_position = float3(0,0,-10); float3 layout_centre = float3(0,0,1...

【Spring框架】Spring AOP
目录 什么是AOP?AOP组成Spring AOP 实现步骤Spring AOP实现原理JDK Proxy VS CGLIB 什么是AOP? AOP(Aspect Oriented Programming):⾯向切⾯编程,它是⼀种思想,它是对某⼀类事情的集中处理。⽐如…...

寻找旋转排序数组中的最小值——力扣153
文章目录 题目描述解法 二分法 题目描述 解法 二分法 int findMin(vector<int>& nums){int l0, rnums.size()-1;while(l<r){int mid (lr)/2;if(nums[mid]<nums[r]) rmid;else lmid1;}return nums[l];}...

安卓逆向 - 基础入门教程
一、引言 1、我们在采集app数据时,有些字段是加密的,如某麦网x-mini-wua x-sgext x-sign x-umt x-utdid等参数,这时候我们需要去分析加密字段的生成。本篇将以采集的角度讲解入门安卓逆向需要掌握的技能、工具。 2、安卓(Androi…...

验证码安全志:AIGC+集成环境信息信息检测
目录 知己知彼,黑灰产破解验证码的过程 AIGC加持,防范黑灰产的破解 魔高一丈,黑灰产AIGC突破常规验证码 双重防护,保障验证码安全 黑灰产经常采用批量撞库方式登录用户账号,然后进行违法违规操作。 黑灰产将各种方…...

R-Meta分析教程
详情点击链接:R-Meta模型教程 一:Meta分析的选题与文献计量分析CiteSpace应用 1、Meta分析的选题与文献检索 1)什么是Meta分析? 2)Meta分析的选题策略 3)文献检索数据库 4)精确检索策略,如何检索全、检索准 5)文献的管理与…...

【3维视觉】3D空间常用算法(点到直线距离、面法线、二面角)
3D空间点到直线的距离 3D空间点到直线的距离 3D空间的曲率 三维空间有三个基本元素,点,线,面。那么曲率是如何定义的呢? 点的曲率? 线的曲率? 面的曲率? 法曲率 设曲面上的曲线在某一点处的切…...

Nodejs 第四章(Npm install 原理)
在执行npm install 的时候发生了什么? 首先安装的依赖都会存放在根目录的node_modules,默认采用扁平化的方式安装,并且排序规则.bin第一个然后系列,再然后按照首字母排序abcd等,并且使用的算法是广度优先遍历,在遍历依…...

[深度学习] GPU处理能力(TFLOPS/TOPS)
计算能力换算 理论峰值 = GPU芯片数量GPU Boost主频核心数量*单个时钟周期内能处理的浮点计算次数 只不过在GPU里单精度和双精度的浮点计算能力需要分开计算,以最新的Tesla P100为例: 双精度理论峰值 = FP64 Cores *…...

js:获取浏览器默认语言
实现代码 navigator.language zh-CN参考文章 [javascript] js如何获取浏览器的语言...

【U8+】用友U8重新注册加密锁,提示:写卡失败,请重新配置客户端控件。
【问题描述】 用友U8软件重新安装后,需要重新注册加密锁激活软件。 注册反馈提示:产品注册失败。 原因(1):写卡失败,请重新配置客户端控件。 【解决方法】 1、打开控制面板,网络和 Internet&a…...

uniapp小程序console.log在微信开发者工具中不打印问题
最近在开发一款uniapp小程序,发现console.log在微信开发者工具中不打印,但在H5页面就能够有打印输出,于是在网上寻找原因… 主要是由于vue.config.js文件中有设置发布时删除console的配置,如下: 官网参考地址&#x…...

从零基础开始开发自己的第一个微信小程序
文章目录 内容介绍小程序开发步骤注册微信小程序账号下载开发工具搭建开发环境创建工程编写代码手机上查看效果 工程里的文件作用介绍总结 内容介绍 通过本篇blog,你可以熟悉从零开始,搭建小程序开发环境,并运行起自己的第一个小程序。 小程…...

无涯教程-Lua - Arrays(数组)
数组是对象的有序排列,可以是包含行集合的一维数组,也可以是包含多行和多列的多维数组。 在Lua中,数组是使用带有整数的索引表实现的。数组的大小不是固定的,并且可以根据无涯教程的要求(取决于内存限制)来增长。 一维数组 一维…...

0基础学习VR全景平台篇 第76篇:全景相机-圆周率全景相机如何直播推流
圆周率科技,成立于2012年,是中国最早投身嵌入式全景算法研发的团队之一,亦是全球市场占有率最大的全景算法供应商。相继推出一体化智能屏、支持一键高清全景直播的智慧全景相机--Pilot Era和Pilot One,为用户带来实时畅享8K的高清…...

超详细|ChatGPT论文润色教程
本文讲述使用中科大开源ChatGPT论文辅助工具,对论文进行润色 祝看到本教程的小伙伴们都完成论文,顺利毕业。 可以加QQ群交流,一群: 123589938 第一章 介绍 今天给大家分享一款非常不错的ChatGPT论文辅助工具,使用了专…...

MMDeploy安装、python API测试及C++推理
服务器配置如下: Cuda版本:11.1 Cudnn版本:8.2.0 显卡版本:RTX3090 使用转换脚本将.pth模型转换为ONNX格式 python mmdeploy/tools/deploy.py \mmdeploy/configs/mmdet/detection/detection_onnxruntime_dynamic.py \mmdetect…...

[openCV]基于拟合中线的智能车巡线方案V3
import cv2 as cv import os import numpy as np# 遍历文件夹函数 def getFileList(dir, Filelist, extNone):"""获取文件夹及其子文件夹中文件列表输入 dir:文件夹根目录输入 ext: 扩展名返回: 文件路径列表"""newDir d…...

vite+typescript项目 :找不到模块“./***.vue”或其相应的类型声明——解决方案
vue3ts报错: 找不到模块“./App.vue”或其相应的类型声明。ts(2307) 解决方法: 1、在src文件夹找到 vite-env.d.ts 加入以下代码: declare module *.vue {import type { DefineComponent } from vueconst vueComponent: DefineComponent<…...

Gradio-YOLOv5-YOLOv7 搭建Web GUI
目录 0 相关资料:1 Gradio介绍2 环境搭建3 GradioYOLOv54 GradioYOLOv75 源码解释 0 相关资料: Gradio-YOLOv5-Det:https://gitee.com/CV_Lab/gradio_yolov5_det 【手把手带你实战YOLOv5-入门篇】YOLOv5 Gradio搭建Web GUI: https://www.bi…...

HTML模板生成word,pdf文档
1.获取html模板 public static void main(String[] args) {String htmlContent getHtmlFileContent(templateName,dataMap);String exportType "pdf";if (exportType.equals("pdf")){convertToPdf(htmlContent,filePath);}else {exportWord(htmlContent…...

ssl单向证书和双向证书校验测试及搭建流程
零、前提准备 首先了解下HTTP和HTTPS的区别: HTTPS与HTTP有什么不同? HTTP是过去很长一段时间我们经常用到的一种传输协议。HTTP协议传输的数据都是未加密的,这就意味着用户填写的密码、账号、交易记录等机密信息都是明文,随时…...

【2种方法,jmeter用一个正则提取器提取多个值!】
jmeter中,用json提取器,一次提取多个值,这个很多人都会。但是,用正则提取器一次提取多个,是否可以呢? 肯定,很多人都自信满满的说,可以!形如:token":&q…...

012-堆,结构体
012-堆,结构体 堆空间的申请和释放 堆空间特点? 栈空间的特点是,自动申请自动释放 堆空间由用户自己主动申请,主动释放 利用函数malloc进行堆空间的申请 利用函数free进行堆空间使用完毕后的释放 问题: 局部变量的存储空间在栈区; 全局变量的存储空…...

GDAL C++ API 学习之路 OGRGeometry 多边形类 OGRPolygon
OGRPolygon class OGRPolygon 是 OGR 几何图形库中的一个类,用于表示多边形的几何图形。它是一种封闭的多边形,由一个或多个外环(OGRLinearRing)和零个或多个内环(OGRLinearRing)组成。多边形是平…...

文件传输协议FTP与托管文件传输MFT有什么区别?
传输敏感数据是日常业务中不可或缺的一环。但是,在把敏感数据从A点搬到B点的过程中,保证该敏感数据的安全是组织的重要任务,因此最好选择一种能够确保文件安全的方案。 FTP与MFT有什么不同? FTP(文件传输协议…...

js实现按照句号将一段文本进行分段
/*** 将给定的文本按照300字并且按照句号分为多个p标签** param text 给定的文本* returns 返回分割后的多个p标签的数组*/ function splitTextByParagraph(text) {// 将文本按照句号分割成多个句子const sentences text.split(。);// 初始化一个空数组来存储生成的p标签const…...

环形链表的进一步探究
茕茕白兔,东走西顾,衣不如新,人不如故 往期回顾: 数据结构——双向链表 数据结构——单链表 数据结构——顺序表 文章目录 如何判断一个链表是否为环形链表 环形链表的判断的深入探究 例1:沸羊羊追美羊羊 例…...