docker learn :services docker-compose.yml
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> docker-compose.yml定义了服务的运行参数 version: "3" services: web: # replace username/repo:tag with your name and image details image: hub.c.163.com/dog948453219/friendlyhello deploy: replicas: 8 resources: limits: cpus: "0.1" memory: 50M restart_policy: condition: on-failure ports: - "4000:80" networks: - webnet networks: webnet: ~ ~ 文件中做的事情有 从hub中拉取镜像 运行5个web实例,限制每个使用10%cpu,50mb RAM 如果有失败的实例立即重启 映射访问端口4000到web80端口 访问时负载均衡 1.运行web实例 docker swarm init docker stack deploy -c docker-compose.yml getstartedlab docker service ls docker service ps getstartedlab_web docker