DOCKER学习_018:Docker-Compose文件简介
Docker-Compose文件
通过之前的示例,其实我们可以看到,所有服务的管理,都是依靠docker-compose.yml文件来实现的。那么我们接下来就详细说一说docker-compose.yml文件中的常用指令。
compose文件使用yml格式,docker规定了一些指令,使用它们可以去设置对应的东西,主要分为了四个区域:
- version:用于指定当前docker-compose.yml语法遵循哪个版本
- services:服务,在它下面可以定义应用需要的一些服务,每个服务都有自己的名字、使用的镜像、挂载的数据卷、所属的网络、依赖哪些其他服务等等。
- networks:应用的网络,在它下面可以定义应用的名字、使用的网络类型等。
- volumes:数据卷,在它下面可以定义数据卷,然后挂载到不同的服务下去使用。
官方网站:https://docs.docker.com/compose/
1 version语法
用于指定当前compose文件语法遵循哪个版本,下面这张表是不同的Compose文件版本兼容的Docker版本:
[root@docker-server3 docker-compose]# docker-compose version
docker-compose version 1.25.0, build 0a186604
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.0l 10 Sep 2019
这里的版本是这个指令的版本,上面的版本是语法的版本,语法不停的更新,version就是指定语法版本
也可以精确到小版本
将前面的版本修改为1,尝试
[root@docker-server3 docker-compose]# vi docker-compose.yml
version: '1'
services:
httpd-test:
image: httpd:2.4
httpd-test-2:
image: httpd:2.4
volumes:
- "/data:/var/www/html"
ports:
- "80:80"
httpd-test-3:
image: httpd:2.4
volumes:
- "/data:/usr/local/apache2/htdocs"
ports:
- "8080:80"
[root@docker-server3 docker-compose]# docker-compose stop
使用指令报版本错误
ERROR: Version in "./docker-compose.yml" is invalid. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
2 services
定义 docker- compose管理的服务,包括服务的名称、使用的镜像、挂载的数据卷、所属的网络、依赖等等
上面的实例
[root@docker-server3 docker-compose]# vi docker-compose.yml
version: '3'
services:
#docker run -d --name docker-compose_httpd-test_1 httpd:2.4
httpd-test:
image: httpd:2.4
#docker run -d --name docker-compose_httpd-test-2_1 -v /data:/var/www/html -p 80:80 httpd:2.4
httpd-test-2:
image: httpd:2.4
volumes:
- "/data:/var/www/html"
ports:
- "80:80"
#docker run -d --name docker-compose_httpd-test-3_1 -v /data:/usr/local/apache2/htdocs:rw -p 8080:80 httpd:2.4
httpd-test-3:
image: httpd:2.4
volumes:
- "/data:/usr/local/apache2/htdocs:rw"
ports:
- "8080:80"
上面一共三个容器,使用dockers run运行就是
docker run -d --name docker-compose_httpd-test_1 httpd:2.4
docker run -d --name docker-compose_httpd-test-2_1 -v /data:/var/www/html -p 80:80 httpd:2.4
docker run -d --name docker-compose_httpd-test-3_1 -v /data:/usr/local/apache2/htdocs:rw -p 8080:80 httpd:2.4
第一行缩进就是容器的名字,但是在启动后,docker-compose会自动添加信息作为容器的名字
image:就是镜像的名字
容器在docker-compose都是后台运行的
3 volumes
自定义数据卷
下面的- 表示可以跟多个
version: '3'
services:
httpd-test-2:
image: httpd:2.4
volumes:
- "/data:/var/www/html"
- "/etc/localtime:/etc/localtime"
ports:
- "80:80"
- "2222:22"
docker命令:docker run -d --name docker-compose_httpd-test-2_1 -v /data:/var/www/html -v /etc/localtime:/etc/localtime -p 2222:22 -p 80:80 httpd:2.4
volumes,可以不指定挂载路径,则会把路径挂载在本地的默认路径下使用driver:local
4 environment
相当于-e传参数
version: '3'
services:
httpd-test:
image: httpd:2.4
httpd-test-2:
image: httpd:2.4
volumes:
- "/data:/var/www/html"
- "/etc/localtime:/etc/localtime"
ports:
- "80:80"
- "2222:22"
httpd-test-3:
image: httpd:2.4
volumes:
- "/data:/usr/local/apache2/htdocs:rw"
ports:
- "8080:80"
environment:
index: "test"
[root@docker-server3 docker-compose]# docker-compose up -d
Recreating docker-compose_httpd-test-2_1 ...
Recreating docker-compose_httpd-test-2_1 ... done
Recreating docker-compose_httpd-test-3_1 ... done
[root@docker-server3 docker-compose]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ab6ac7926b25 httpd:2.4 "httpd-foreground" 6 seconds ago Up 4 seconds 0.0.0.0:8080->80/tcp docker-compose_httpd-test-3_1
c47a18060afe httpd:2.4 "httpd-foreground" 6 seconds ago Up 4 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:2222->22/tcp docker-compose_httpd-test-2_1
a1dabe398019 httpd:2.4 "httpd-foreground" 24 hours ago Up 24 hours 80/tcp docker-compose_httpd-test_1
[root@docker-server3 docker-compose]# docker exec -it ab6ac7926b25 /bin/bash
root@ab6ac7926b25:/usr/local/apache2# env
index=test #定义的环境变量
HOSTNAME=ab6ac7926b25
PWD=/usr/local/apache2
HTTPD_VERSION=2.4.41
HOME=/root
HTTPD_PATCHES=
TERM=xterm
HTTPD_SHA256=133d48298fe5315ae9366a0ec66282fa4040efa5d566174481077ade7d18ea40
SHLVL=1
PATH=/usr/local/apache2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HTTPD_PREFIX=/usr/local/apache2
_=/usr/bin/env
5 networks
网络决定了服务之间以及服务和外界之间如何去通信,在执行docker-compose up的时候,docker会默认创建一个默认网络,创建的服务也会默认的使用这个默认网络。服务和服务之间,可以使用服务的名字进行通信,也可以自己创建网络,并将服务加入到这个网络之中,这样服务之间可以相互通信,而外界不能够与这个网络中的服务通信,可以保持隔离性。
使用host网络
version: '3'
services:
httpd-test:
image: httpd:2.4
httpd-test-2:
image: httpd:2.4
volumes:
- "/data:/var/www/html"
- "/etc/localtime:/etc/localtime"
ports:
- "2222:22"
httpd-test-3:
image: httpd:2.4
volumes:
- "/data:/usr/local/apache2/htdocs:rw"
network_mode: host
#ports:
# - "8080:80"
environment:
index: "test"
[root@docker-server3 docker-compose]# docker-compose up -d
Recreating docker-compose_httpd-test-3_1 ...
Recreating docker-compose_httpd-test-3_1 ... done
Recreating docker-compose_httpd-test-2_1 ... done
[root@docker-server3 docker-compose]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5ab1c92c7465 httpd:2.4 "httpd-foreground" 4 seconds ago Up 3 seconds docker-compose_httpd-test-3_1
84bc3e5e4622 httpd:2.4 "httpd-foreground" 4 seconds ago Up 3 seconds 80/tcp, 0.0.0.0:2222->22/tcp docker-compose_httpd-test-2_1
a1dabe398019 httpd:2.4 "httpd-foreground" 24 hours ago Up 24 hours 80/tcp docker-compose_httpd-test_1
进入容器确认配置
[root@docker-server3 docker-compose]# docker exec -it 5ab1c92c7465 /bin/bash
root@docker-server3:/usr/local/apache2# apt update
root@docker-server3:/usr/local/apache2# apt install net-tools
root@docker-server3:/usr/local/apache2# 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:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp6 0 0 :::2222 :::* LISTEN -
tcp6 0 0 :::80 :::* LISTEN 1/httpd
tcp6 0 0 :::22 :::* LISTEN -
tcp6 0 0 ::1:25 :::* LISTEN -
root@docker-server3:/usr/local/apache2# apt install iproute2
root@docker-server3:/usr/local/apache2# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:f0:04:c9 brd ff:ff:ff:ff:ff:ff
inet 192.168.132.133/24 brd 192.168.132.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::96b0:35ea:c6b0:7bbb/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:ec:71:fc:86 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.1/24 brd 192.168.0.255 scope global docker0
valid_lft forever preferred_lft forever
4: br-8f5945aac199: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:b0:d4:21:b4 brd ff:ff:ff:ff:ff:ff
inet 172.22.16.1/24 brd 172.22.16.255 scope global br-8f5945aac199
valid_lft forever preferred_lft forever
5: br-a1db538e7759: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:cf:8b:20:fd brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global br-a1db538e7759
valid_lft forever preferred_lft forever
inet6 fe80::42:cfff:fe8b:20fd/64 scope link
valid_lft forever preferred_lft forever
12475: br-4b1032d9c860: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:77:39:81:1e brd ff:ff:ff:ff:ff:ff
inet 172.19.0.1/16 brd 172.19.255.255 scope global br-4b1032d9c860
valid_lft forever preferred_lft forever
inet6 fe80::42:77ff:fe39:811e/64 scope link
valid_lft forever preferred_lft forever
12487: veth5185239@if12486: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-4b1032d9c860 state UP group default
link/ether d2:ea:d1:45:fb:fd brd ff:ff:ff:ff:ff:ff link-netnsid 1
inet6 fe80::d0ea:d1ff:fe45:fbfd/64 scope link
valid_lft forever preferred_lft forever
12493: veth4949bb2@if12492: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-4b1032d9c860 state UP group default
link/ether 8e:ff:3d:8b:a7:07 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::8cff:3dff:fe8b:a707/64 scope link
valid_lft forever preferred_lft forever
6 安装Harbor的各个文件解释
[root@docker-server3 docker-compose]# cd /usr/local/harbor/
[root@docker-server3 harbor]# ll
drwxr-xr-x 3 root root 20 Jan 3 03:34 common
-rw-r--r-- 1 root root 5345 Jan 3 03:57 docker-compose.yml
-rw-r--r-- 1 root root 5821 Jan 3 03:57 harbor.yml
-rwxr-xr-x 1 root root 5088 Nov 18 03:37 install.sh
-rw-r--r-- 1 root root 11347 Nov 18 03:37 LICENSE
drwxr-xr-x 2 root root 60 Jan 3 03:33 pki
-rwxr-xr-x 1 root root 1748 Nov 18 03:37 prepare
最初只有harbor.yml,install.sh,和prepare三个文件
修改harbar.yml文件,然后执行prepare,就会把所有的需要的文件放在common里面。同时生成一个docker-compose,yml文件
install.sh就是把docker-compose.yml文件启动起来
所以也可以不用instll.sh.直接启动
[root@docker-server3 harbor]# docker-compose up -d
Creating harbor-log ... done
Creating registryctl ... done
Creating harbor-portal ... done
Creating harbor-db ... done
Creating registry ... done
Creating redis ... done
Creating harbor-core ... done
Creating nginx ... done
Creating harbor-jobservice ... done
[root@docker-server3 harbor]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e4c160319a13 goharbor/harbor-jobservice:v1.9.3 "/harbor/harbor_jobs…" 30 seconds ago Up 29 seconds (health: starting) harbor-jobservice
4148f0b1f95f goharbor/nginx-photon:v1.9.3 "nginx -g 'daemon of…" 30 seconds ago Up 29 seconds (health: starting) 0.0.0.0:80->8080/tcp, 0.0.0.0:443->8443/tcp nginx
6b29d3e6b527 goharbor/harbor-core:v1.9.3 "/harbor/harbor_core" 30 seconds ago Up 29 seconds (health: starting) harbor-core
e984dd36124a goharbor/redis-photon:v1.9.3 "redis-server /etc/r…" 31 seconds ago Up 30 seconds (health: starting) 6379/tcp redis
9a95a1282c96 goharbor/registry-photon:v2.7.1-patch-2819-2553-v1.9.3 "/entrypoint.sh /etc…" 31 seconds ago Up 30 seconds (health: starting) 5000/tcp registry
1cb8ff7be670 goharbor/harbor-db:v1.9.3 "/docker-entrypoint.…" 31 seconds ago Up 30 seconds (healthy) 5432/tcp harbor-db
88ab0ce7c486 goharbor/harbor-portal:v1.9.3 "nginx -g 'daemon of…" 31 seconds ago Up 30 seconds (healthy) 8080/tcp harbor-portal
6abda5d0dc91 goharbor/harbor-registryctl:v1.9.3 "/harbor/start.sh" 31 seconds ago Up 30 seconds (healthy) registryctl
816b9f7851c3 goharbor/harbor-log:v1.9.3 "/bin/sh -c /usr/loc…" 31 seconds ago Up 31 seconds (healthy) 127.0.0.1:1514->10514/tcp harbor-log
7 查看docker-compose.yml
[root@docker-server3 harbor]# cat docker-compose.yml
version: '2.3'
services:
log:
image: goharbor/harbor-log:v1.9.3
container_name: harbor-log
restart: always
dns_search: .
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
- SETGID
- SETUID
volumes:
- /var/log/harbor/:/var/log/docker/:z #这里是容器日志的位置
- ./common/config/log/logrotate.conf:/etc/logrotate.d/logrotate.conf:z
- ./common/config/log/rsyslog_docker.conf:/etc/rsyslog.d/rsyslog_docker.conf:z
ports:
- 127.0.0.1:1514:10514
networks:
- harbor
registry:
image: goharbor/registry-photon:v2.7.1-patch-2819-2553-v1.9.3
container_name: registry
restart: always
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
volumes:
- /data/registry:/storage:z
- ./common/config/registry/:/etc/registry/:z
- type: bind
source: /data/secret/registry/root.crt
target: /etc/registry/root.crt
networks:
- harbor
dns_search: .
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "registry"
registryctl:
image: goharbor/harbor-registryctl:v1.9.3 #镜像
container_name: registryctl #容器的hostname
env_file:
- ./common/config/registryctl/env
restart: always #容器挂掉自动重启
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
volumes:
- /data/registry:/storage:z #:z表示使用默认权限
- ./common/config/registry/:/etc/registry/:z
- type: bind #写法不同,功能是一致的
source: ./common/config/registryctl/config.yml
target: /etc/registryctl/config.yml
networks:
- harbor #使用的自定义的网络
dns_search: .
depends_on: #依赖的容器
- log
logging: #定义的日志输出
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514" #这是把日志输出到log日志容器里面
tag: "registryctl"
postgresql:
image: goharbor/harbor-db:v1.9.3
container_name: harbor-db
restart: always
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
- SETGID
- SETUID
volumes:
- /data/database:/var/lib/postgresql/data:z
networks:
harbor:
dns_search: .
env_file: #单个写是environment定义环境变量,但是也可以统一写道一个文件,然后使用这个调用
- ./common/config/db/env
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "postgresql"
core:
image: goharbor/harbor-core:v1.9.3
container_name: harbor-core
env_file:
- ./common/config/core/env
restart: always
cap_drop:
- ALL
cap_add:
- SETGID
- SETUID
volumes:
- /data/ca_download/:/etc/core/ca/:z
- /data/psc/:/etc/core/token/:z
- /data/:/data/:z
- ./common/config/core/certificates/:/etc/core/certificates/:z
- type: bind
source: ./common/config/core/app.conf
target: /etc/core/app.conf
- type: bind
source: /data/secret/core/private_key.pem
target: /etc/core/private_key.pem
- type: bind
source: /data/secret/keys/secretkey
target: /etc/core/key
networks:
harbor:
dns_search: .
depends_on:
- log
- registry
- redis
- postgresql
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "core"
portal:
image: goharbor/harbor-portal:v1.9.3
container_name: harbor-portal
restart: always
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
- NET_BIND_SERVICE
networks:
- harbor
dns_search: .
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "portal" jobservice:
image: goharbor/harbor-jobservice:v1.9.3
container_name: harbor-jobservice
env_file:
- ./common/config/jobservice/env
restart: always
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
volumes:
- /data/job_logs:/var/log/jobs:z
- type: bind
source: ./common/config/jobservice/config.yml
target: /etc/jobservice/config.yml
networks:
- harbor
dns_search: .
depends_on:
- core
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "jobservice"
redis:
image: goharbor/redis-photon:v1.9.3
container_name: redis
restart: always
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
volumes:
- /data/redis:/var/lib/redis
networks:
harbor:
dns_search: .
depends_on:
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "redis"
proxy:
image: goharbor/nginx-photon:v1.9.3
container_name: nginx
restart: always
cap_drop:
- ALL
cap_add:
- CHOWN
- SETGID
- SETUID
- NET_BIND_SERVICE
volumes:
- ./common/config/nginx:/etc/nginx:z
- /data/secret/cert:/etc/cert:z
networks:
- harbor
dns_search: .
ports:
- 80:8080
- 443:8443
depends_on:
- registry
- core
- portal
- log
logging:
driver: "syslog"
options:
syslog-address: "tcp://127.0.0.1:1514"
tag: "proxy"
networks:
harbor:
external: false
以上就是关于daoker-compose配置文件的一个简单介绍,可以参阅官方的文档,进行更深入的研究
博主声明:本文的内容来源主要来自誉天教育晏威老师,由本人实验完成操作验证,需要的博友请联系誉天教育(http://www.yutianedu.com/),获得官方同意或者晏老师(https://www.cnblogs.com/breezey/)本人同意即可转载,谢谢!
DOCKER学习_018:Docker-Compose文件简介的更多相关文章
- Docker学习笔记 — Docker私有仓库搭建
Docker学习笔记 — Docker私有仓库搭建 目录(?)[-] 环境准备 搭建私有仓库 测试 管理仓库中的镜像 查询 删除 Registry V2 和Mavan的管理一样,Dockers ...
- Docker学习之Docker容器基本使用
Docker学习之Docker容器基本使用 新建容器并启动 命令格式:docker run --options repository:tag 后台运行 命令格式:-d 已存在的容器相关操作 启动:do ...
- Docker学习之Docker镜像基本使用
Docker学习之Docker镜像基本使用 获取镜像 命令格式:docker pull [选项] [Docker Registry 地址[:端口号]/]仓库名[:标签] 例如: docker pull ...
- DOCKER学习_001:Docker简介
一 Docker简介 1.1 docker由来 Docker的英文翻译是“码头工人”,即搬运工,它搬运的东西就是我们常说的集装箱Container,Container里面装的是任意类型的App.我们的 ...
- docker学习(一) - docker简介
(一)Docker是什么? Docker 是一个开源的应用容器引擎,你可以将其理解为一个轻量级的虚拟机,开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上 ...
- DOCKER学习_016:Docker镜像仓库和HARBOR的简单安装和管理
一 镜像仓库介绍 1.1 简介 镜像仓库用于存放 Docker镜像 Docker registry提供镜像仓库服务 一个 Docker registry可以包含多个镜像仓库 仓库分为公共镜像仓库与私有 ...
- Docker 学习9 Docker私有registry
一.docker registry分类 二.安装docker-hub提供的registry 1.安装 [root@localhost yum.repos.d]# yum install -y dock ...
- Docker学习之Docker Registry
前言 前面已经学习了怎样通过Dockerfile来构建我们自己的镜像了,但是一个系统可能包含着很多个微服务即有很多个镜像,当镜像越来越多的时候,就必须得有一个地方来管理这些镜像,Docker官方提供了 ...
- Docker学习:Docker安装和基本使用
Docker Docek是一种容器技术.容器是一种轻量级.可移植.自打包的软件技术,使应用程序可以在几乎任何地方以相同的方式运行. 使用者可以在笔记本上创建并测试好的容器,无需任何修改就能够在生产系统 ...
随机推荐
- python3使用myqr生成链接二维码
技术背景 二维码技术在各个领域中都已经有非常成熟的应用,比如随处可见的二维码支付,比如疫情期间的绿码,再比如工业领域中,可以使用二维码作为定位的标签,大大提升了室内定位技术的精确度.二维码的格式内容大 ...
- IDEA/JRebel实现内部/外部/远程Tomcat热部署Spring Boot
1 概述 所谓热部署,对于Java应用程序来说,就是在运行时更新Java类文件.IDEA可以使用自带的Spring Boot热部署的方式进行本地/远程热部署,或者使用JRebel进行本地/远程热部署, ...
- .netcore 写快递100的快递物流信息查询接口
快递100的物流信息查询接口,官方提供了一些demo;还好官方提供的代码是.netcore版本写的,不过写的有点low;根据官方提供的代码,我按照.netcore 的风格重构了代码:核心代码如下: / ...
- Ananagrams UVA - 156
Most crossword puzzle fans are used to anagrams - groups of words with the same letters in differe ...
- matlab逻辑类型
matlab逻辑类型 matlab逻辑表达式输出:1为真,0为假. matlab关系操作符: 关系操作符 说明 < 小于 <= 小于等于 > 大于 >= 大于等于 == 等于 ...
- JUC包的线程池详解
为什么要使用线程池 创建/销毁线程需要消耗系统资源,线程池可以复用已创建的线程. 控制并发的数量.并发数量过多,可能会导致资源消耗过多,从而造成服务器崩溃.(主要原因) 可以对线程做统一管理. JUC ...
- Django--虚拟环境、项目和应用的创建
第一点:官方手册 -- https://yiyibooks.cn/ 第二点:运行环境 -- django项目采用虚拟运行环境 之前我们pip install都是在Python的安装目录(底层)上安装的 ...
- Thinkphp5之laypage分页插件的实现
//一下是laypage所用到的 js <script type="text/javascript" src="__STATIC__/lib/laypage/1.2 ...
- 过 DNF TP 驱动保护(一)
过 DNF TP 驱动保护(一) 文章目录: 01. 博文简介: 02. 环境及工具准备: 03. 分析 TP 所做的保护: 04. 干掉 NtOpenProc ...
- 病毒木马查杀实战第012篇:QQ盗号木马之逆向分析
前言 在本系列的文章中,对每一个病毒分析的最后一个部分,若无特殊情况,我都会采用逆向分析的手段来为读者彻底剖析目标病毒.但是之前的"熊猫烧香"病毒,我用了三篇文章的篇幅(每篇250 ...