Docker-compose.yml CMS with rsync and mysqldump (SSH?)

I currently have a file docker-compose.yml:

version: '3.8'

services:
  db:
    image: mariadb:latest
    # networks:
    #   - xxx
    volumes:
      - wordpress_baza:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=somewordpress
      - MYSQL_DATABASE=wordpress
      - MYSQL_USER=wordpress
      - MYSQL_PASSWORD=wordpress
  wordpress:
    image: wordpress:latest
    # networks:
    #   - xxx
    ports:
      - "80:80"
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=wordpress
      - WORDPRESS_DB_PASSWORD=wordpress
      - WORDPRESS_DB_NAME=wordpress
    volumes:
      - wordpress_pliki:/var/www/html

# networks:
#   xxx:

volumes:
  wordpress_baza:
  wordpress_pliki:

I would like to add rsync support (to sync files from CMS to local computer) and mysqldump (to backup MySQL database to local computer).

How to modify a file? Do I need to build stock on a linux image with SSH access?

Edit
For mysqldump I find resolve→ Backup and restore a mysql database from a running Docker mysql container · GitHub

I cannot edit the topic above. And the solution for rsync is to rebuild docker-compose.yml to ↓

volumes:
      # - wordpress_pliki:/var/www/html
      - /home/juzek/xxx/wp/docker/files:/var/www/html