0

Есть рой с виртуальными нодами. С помощью Docker stack deploy развертывается кластер Consul

version: '3.6'

x-consul: &consul
  image: consul:latest
  volumes:
    - consul:/consul

volumes:
  consul:

services:
  client:
    <<: *consul
    command: "agent -retry-join server-bootstrap -client 0.0.0.0 -bind '{{ GetInterfaceIP \"eth0\" }}'"
    depends_on:
     - server-bootstrap
    deploy:
      replicas: 2

  server:
    <<: *consul
    ports:
     - "8500:8500"
    depends_on:
    - server-bootstrap
    command: "agent -server -retry-join server-bootstrap -client 0.0.0.0 -bind '{{ GetInterfaceIP \"eth0\" }}' -ui"
    deploy:
      replicas: 2
    placement:
      constraints: [node.role == manager]

   server-bootstrap:
     image: consul
     command: "agent -server -bootstrap-expect 3 -client 0.0.0.0 -bind '{{ GetInterfaceIP \"eth0\" }}'"
     deploy:
       placement:
         constraints: [node.role == manager]

А так же развертываю(в этом же файле, т.е. у них одна сеть) контейнер с своим образом spring на одном из воркеров. Вопрос, по какому адресу должен подключаться spring, ибо localhost:8500 не доступен из контейнера

1 ответ 1

0

имя сервиса по дефолту является хостом сервиса в докерсварме. Хост можно переопределись параметром host

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.