docker-compose.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. version: '2.3'
  2. volumes:
  3. database:
  4. ssh_host_keys:
  5. services:
  6. sample_database:
  7. image: docker.io/mariadb:10.5.8
  8. environment:
  9. MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
  10. MYSQL_USER: someone
  11. MYSQL_PASSWORD: secret
  12. MYSQL_DATABASE: demo
  13. # https://github.com/docker-library/mariadb/issues/251
  14. # https://github.com/docker-library/mariadb/issues/262#issuecomment-536405303
  15. MYSQL_INITDB_SKIP_TZINFO: 1
  16. volumes:
  17. - database:/var/lib/mysql:rw
  18. sshd:
  19. build: .
  20. image: docker.io/fphammerle/mysqldump-sshd
  21. environment:
  22. SSH_CLIENT_PUBLIC_KEYS: |
  23. ssh-rsa ...
  24. ssh-rsa ...
  25. MYSQLDUMP_ARGS: >-
  26. --host=sample_database
  27. --user=someone
  28. --password=secret
  29. --skip-add-drop-table
  30. --skip-comments
  31. --skip-dump-date
  32. --databases demo
  33. read_only: true
  34. volumes:
  35. - type: volume
  36. source: ssh_host_keys
  37. target: /etc/ssh/host_keys
  38. read_only: false
  39. - type: tmpfs
  40. target: /home/dump/.ssh # authorized_keys
  41. tmpfs:
  42. # nosuid,nodev,noexec added by default
  43. mode: '1777'
  44. size: 16k
  45. ports: ['127.0.0.1:2200:2200']
  46. cap_drop: [ALL]
  47. # strace
  48. # cap_add: [SYS_PTRACE]
  49. security_opt: [no-new-privileges]
  50. # docker-compose >=2.2,<3
  51. cpus: 0.2
  52. mem_limit: 64M
  53. # https://docs.docker.com/compose/compose-file/compose-file-v2/