docker-compose限制内存, cpu资源以及固定ip写法
docker-compose v3版本写法
首先手动创建网络, 指定子网, 否则会报错
docker network create --subnet 172.88.88.0/24 devops
version: '3' services: accountmgr-api: container_name: accountmgr-api image: harbor.rxtd.com:8082/rxtd/accountmgr-api:10 ports: - 38080:8080 networks: default: ipv4_address: 172.88.88.2 deploy: resources: limits: cpus: '2' memory: 2G reservations: cpus: '0.5' memory: 200M networks: default: external: name: devops
启动容器
docker-compose --compatibility -f gateway.yml up -d
由于做了资源限制, 并且没有使用swarm, 所以要加上--compatibility
参数, 不然会报错
WARNING: Some services (web) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use docker stack deploy to deploy to a swarm.
相关推荐
链块学院 2020-11-06
afanti 2020-09-14
白开水 2020-07-19
liyansring 2020-07-18
shenzhenzsw 2020-07-18
啦啦啦啦啦 2020-06-28
yangliuhbhd 2020-06-12
小爷有点狂 2020-06-12
无风的雨 2020-06-12
changecan 2020-06-11
蒜蓉粉丝蒸扇贝 2020-06-10
lihongtai 2020-06-08
liaochaowu 2020-06-06
zwt00 2020-06-05
scmrpu 2020-06-02
kuzilala 2020-05-14
小信 2020-05-14