Advertisement
RobertBerger

tig stack host network

Jan 30th, 2021
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. version: "3"
  2. services:
  3. influxdb:
  4. container_name: influxdb
  5. image: influxdb:1.8.3
  6. # this needs to be accessible from outside (other telegrafs)
  7. # and from telegraf (inside)
  8. network_mode: "host"
  9. ports:
  10. - "8086:8086"
  11. volumes:
  12. - /home/student/projects/tig/data/influxdb:/var/lib/influxdb
  13. - /home/student/projects/mqtt-telegraf-influxdb-grafana/conf/influxdb:/etc/influxdb/
  14. restart: always
  15.  
  16. telegraf:
  17. container_name: telegraf
  18. image: telegraf:1.17.1
  19. depends_on:
  20. - influxdb
  21. network_mode: "host"
  22. volumes:
  23. - /home/student/projects/mqtt-telegraf-influxdb-grafana/conf/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf
  24. - /var/run/docker.sock:/var/run/docker.sock
  25. restart: always
  26.  
  27. grafana:
  28. container_name: grafana
  29. image: grafana/grafana:7.3.7
  30. depends_on:
  31. - influxdb
  32. network_mode: "host"
  33. user: "0"
  34. ports:
  35. - "3000:3000"
  36. volumes:
  37. - /home/student/projects/tig/data/grafana:/var/lib/grafana
  38. - /home/student/projects/tig/log/grafana:/var/log/grafana
  39. - /home/student/projects/mqtt-telegraf-influxdb-grafana/conf/grafana/grafana.ini:/etc/grafana/grafana.ini
  40. restart: always
  41.  
  42. mqtt:
  43. container_name: mqtt
  44. image: eclipse-mosquitto:latest
  45. network_mode: "host"
  46. user: "0"
  47. ports:
  48. - "1883:1883"
  49. - "9001:9001"
  50. volumes:
  51. - /home/student/projects/mqtt-telegraf-influxdb-grafana/conf/mqtt/:/mosquitto/config/
  52. - /home/student/projects/tig/data/mqtt/:/mosquitto/data/
  53. - /home/student/projects/tig/log/mqtt/:/mosquitto/log/
  54. restart: always
  55.  
  56.  
  57. -------------------------
  58.  
  59. accessible from outside (another machine)
  60.  
  61. from the same machine:
  62.  
  63. I can get the grafana index.html:
  64.  
  65. # wget localhost:3000
  66. Connecting to localhost:3000 (127.0.0.1:3000)
  67. saving to 'index.html'
  68. index.html 100% |**********************************************************************************************************************************************| 27956 0:00:00 ETA
  69. 'index.html' saved
  70.  
  71. I can access index.html from another container:
  72.  
  73. # docker exec -ti influxdb /bin/sh
  74. # wget localhost:3000
  75. --2021-01-30 12:01:33-- http://localhost:3000/
  76. Resolving localhost (localhost)... ::1, 127.0.0.1
  77. Connecting to localhost (localhost)|::1|:3000... connected.
  78. HTTP request sent, awaiting response... 302 Found
  79. Location: /login [following]
  80. --2021-01-30 12:01:33-- http://localhost:3000/login
  81. Reusing existing connection to [localhost]:3000.
  82. HTTP request sent, awaiting response... 200 OK
  83. Length: unspecified [text/html]
  84. Saving to: 'index.html'
  85.  
  86. index.html [ <=> ] 27.30K --.-KB/s in 0.001s
  87.  
  88. 2021-01-30 12:01:33 (33.4 MB/s) - 'index.html' saved [27956]
  89.  
  90.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement