docker-compose.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. version: '2'
  2. volumes:
  3. database:
  4. host_keys:
  5. authorized_keys:
  6. services:
  7. sample_database:
  8. image: mariadb:10.4
  9. environment:
  10. MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
  11. MYSQL_USER: someone
  12. MYSQL_PASSWORD: secret
  13. MYSQL_DATABASE: demo
  14. # https://github.com/docker-library/mariadb/issues/251
  15. # https://github.com/docker-library/mariadb/issues/262#issuecomment-536405303
  16. MYSQL_INITDB_SKIP_TZINFO: 1
  17. volumes:
  18. - database:/var/lib/mysql:rw
  19. sshd:
  20. build: .
  21. image: fphammerle/mysqldump-sshd
  22. environment:
  23. MYSQLDUMP_ARGS: >-
  24. --host=sample_database
  25. --user=someone
  26. --password=secret
  27. --skip-add-drop-table
  28. --skip-comments
  29. --skip-dump-date
  30. --databases demo
  31. volumes:
  32. - host_keys:/etc/ssh/host_keys:rw
  33. - authorized_keys:/home/dump/.ssh:ro
  34. tmpfs:
  35. - /tmp:nosuid,nodev,exec,size=4k # /tmp/mysqldump.sh
  36. read_only: true
  37. ports:
  38. - 127.0.0.1:2222:2222
  39. security_opt: ['no-new-privileges']
  40. # strace
  41. # cap_add: [SYS_PTRACE]
  42. # https://docs.docker.com/compose/compose-file/compose-file-v2/