1、docker-compose.yml文件
version: "3.9"
services:postgis:image: postgis/postgiscontainer_name: postgisrestart: alwaysdeploy:resources:limits:cpus: '1.00'memory: 1Greservations:cpus: '0.50'memory: 1Ghealthcheck:test: [ "CMD", "pg_isready", "-q", "-d", "postgres", "-U", "root" ]timeout: 45sinterval: 10sretries: 10environment:POSTGRES_USER: rootPOSTGRES_PASSWORD: rootALLOW_IP_RANGE: 0.0.0.0/0ports:- 5432:5432volumes:- ./postgis/data:/var/lib/postgis/data #postgis数据卷映射到本地环境- ./postgresql/data:/var/lib/postgresql/data #postgresql数据卷映射到本地环境
2、启动
方式一:资源限制不生效
docker-compose up
资源限制查看方式:
docker stats
方式一:
docker-compose --compatibility up -d
参考:在docker内设置内存与CPU限制
jenkins部署:Jenkins共享库应用入门(CI篇)