首先手动建立网络, 指定子网, 不然会报错web
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
参数, 否则会报错docker
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.