docker-compose.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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: true
  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. --log-level debug
  26. --poweroff-delay-seconds 60
  27. --mqtt-host broker
  28. --mqtt-disable-tls
  29. # --mqtt-username raspberrypi
  30. # --mqtt-password-file /etc/systemctl-mqtt/mqtt-password
  31. hostname: raspberrypi
  32. userns_mode: host
  33. # prefering explicit user specification over "USER 0" in Dockerfile
  34. # to avoid accidental container startup without
  35. # secure apparmor profile and dropped capabilities
  36. user: '0'
  37. read_only: true
  38. cap_drop: [all]
  39. security_opt:
  40. - no-new-privileges
  41. # $ sudo apparmor_parser --replace ./docker-apparmor-profile
  42. # raspberrypi kernel apparmor: https://github.com/raspberrypi/linux/pull/1698#issuecomment-684989048
  43. # https://github.com/raspberrypi/linux/commit/a3e07c5dfef2664fc1d900ebb4a3f91c04ab700b
  44. - apparmor=systemctl-mqtt
  45. # docker-compose >=2.2,<3
  46. cpus: 0.4
  47. mem_limit: 32M
  48. # https://docs.docker.com/compose/compose-file/compose-file-v2/