Advertisement
Guest User

docker-compose

a guest
Jul 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.70 KB | None | 0 0
  1. version: '3.7'
  2.  
  3. services:
  4.   consul:
  5.     image: consul:1.4.0
  6.     container_name: consul
  7.     networks:
  8.       - app_net
  9.     expose:
  10.      - 8500
  11.     ports:
  12.      - 8500:8500
  13.  
  14.   gateway:
  15.     image: api-gateway:1.0-SNAPSHOT
  16.     container_name: gateway
  17.     depends_on:
  18.      - consul
  19.     networks:
  20.       - app_net
  21.     environment:
  22.      - SPRING_CLOUD_CONSUL_HOST=consul
  23.       - SPRING_H2_CONSOLE_ENABLED=true
  24.     expose:
  25.      - 8081
  26.     ports:
  27.      - 8081:8081
  28.  
  29.   app1
  30.     image: app1:1.0-SNAPSHOT
  31.     networks:
  32.       - app_net
  33.     environment:
  34.      - SPRING_CLOUD_CONSUL_HOST=consul
  35.       - SPRING_H2_CONSOLE_ENABLED=true
  36.     expose:
  37.      - 8083
  38.     ports:
  39.      - 8083:8083
  40.  
  41.   app2:
  42.     image: app2:1.0-SNAPSHOT
  43.     networks:
  44.       - app_net
  45.     environment:
  46.      - SPRING_CLOUD_CONSUL_HOST=consul
  47.       - SPRING_H2_CONSOLE_ENABLED=true
  48.     expose:
  49.      - 8092
  50.     ports:
  51.      - 8092:8092
  52.  
  53.  
  54. *************
  55. Так работает:
  56. curl -X POST "http://123.123.123.123:2375/v1.39/images/create?fromImage=repos/api-gateway&tag=1.0-SNAPSHOT"
  57. curl -X POST "http://123.123.123.123:2375/v1.39/containers/front-docker_api-gateway_1/stop"
  58. curl -X DELETE "http://123.123.123.123:2375/v1.39/containers/front-docker_api-gateway_1"
  59.  
  60. curl -H "Content-Type: application/json" -d "{ \"Image\": \"repos/api-gateway:1.0-SNAPSHOT\", \"ExposedPorts\": {\"8081/tcp\": {}},\"Env\":[\"SPRING_CLOUD_CONSUL_HOST=consul\"],\"HostConfig\": {\"PortBindings\": { \"8081/tcp\": [{\"HostPort\": \"8081\"}]}}}" -X POST "http://123.123.123.123:2375/v1.39/containers/create?name=front-docker_api-gateway_1"
  61.  
  62. curl -X POST "http://123.123.123.123:2375/v1.39/containers/front-docker_api-gateway_1/start"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement