docker-compose.yml 1020 B

12345678910111213141516171819202122232425262728293031323334
  1. version: '2.2'
  2. volumes:
  3. config:
  4. services:
  5. mqtt_client:
  6. build: .
  7. image: fphammerle/systemctl-mqtt
  8. volumes:
  9. - config:/etc/systemctl-mqtt:ro
  10. - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:rw
  11. command: systemctl-mqtt
  12. --mqtt-host mqtt-broker.local
  13. --mqtt-username raspberrypi
  14. --mqtt-password-file /etc/systemctl-mqtt/mqtt-password
  15. hostname: raspberrypi
  16. userns_mode: host
  17. # prefering explicit user specification over "USER 0" in Dockerfile
  18. # to avoid accidental container startup without
  19. # secure apparmor profile and dropped capabilities
  20. user: '0'
  21. read_only: true
  22. cap_drop: [all]
  23. security_opt:
  24. - no-new-privileges
  25. # $ sudo apparmor_parser --replace ./docker-apparmor-profile
  26. # raspberrypi kernel apparmor: https://github.com/raspberrypi/linux/pull/1698
  27. - apparmor=systemctl-mqtt
  28. # docker-compose >=2.2,<3
  29. cpus: 0.4
  30. mem_limit: 32M
  31. # https://docs.docker.com/compose/compose-file/compose-file-v2/