使用docker-compose进行安装

  1. version: "3.1"
  2. services:
  3. consul:
  4. image: consul
  5. restart: always
  6. container_name: consul
  7. ports:
  8. - 8500:8500
  9. - 8300:8300
  10. - 8301:8301
  11. - 8302:8302
  12. - 8600:8600/udp
  13. volumes:
  14. - ./data:/consul/data
  15. - ./data:/consul/config
  16. command: agent -dev -client=0.0.0.0

安装好以后进入localhost:8500进入控制面板

使用postman注册服务

image.pngimage.png

可以看到服务已经注册进来了

image.png

使用postman进行服务注销

image.png

注册服务的时候指明健康检查