docker-compose.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. version: '2.2'
  2. networks:
  3. default:
  4. driver_opts:
  5. com.docker.network.bridge.name: systemctl-mqtt
  6. #volumes:
  7. # config:
  8. services:
  9. broker:
  10. image: docker.io/eclipse-mosquitto:latest
  11. user: mosquitto
  12. read_only: yes
  13. #ports: ['127.0.0.1:1883:1883/tcp']
  14. cap_drop: [all]
  15. security_opt: [no-new-privileges]
  16. cpus: 0.4
  17. mem_limit: 32M
  18. client:
  19. build: .
  20. image: fphammerle/systemctl-mqtt
  21. volumes:
  22. #- config:/etc/systemctl-mqtt:ro
  23. - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:rw
  24. command: systemctl-mqtt
  25. --poweroff-delay-seconds 60
  26. --mqtt-host broker
  27. --mqtt-disable-tls
  28. # --mqtt-username raspberrypi
  29. # --mqtt-password-file /etc/systemctl-mqtt/mqtt-password
  30. hostname: raspberrypi
  31. userns_mode: host
  32. # prefering explicit user specification over "USER 0" in Dockerfile
  33. # to avoid accidental container startup without
  34. # secure apparmor profile and dropped capabilities
  35. user: '0'
  36. read_only: true
  37. cap_drop: [all]
  38. security_opt:
  39. - no-new-privileges
  40. # $ sudo apparmor_parser --replace ./docker-apparmor-profile
  41. # raspberrypi kernel apparmor: https://github.com/raspberrypi/linux/pull/1698#issuecomment-684989048
  42. # https://github.com/raspberrypi/linux/commit/a3e07c5dfef2664fc1d900ebb4a3f91c04ab700b
  43. - apparmor=systemctl-mqtt
  44. # docker-compose >=2.2,<3
  45. cpus: 0.4
  46. mem_limit: 32M
  47. # https://docs.docker.com/compose/compose-file/compose-file-v2/