Run wp search-replace command within container

How can run a WordPress cli command (wp search-replace) within a docker container on an existing standard wordpress docker-compose configuration?

I have a dump.sql of the data. I’d prefer to run the command on this data dump file if possible. If required, then I can run it directly on the running wp database container.

I’d simply like to run the wp cli container to execute the command. Or am I required to add the container definition within my docker-compose to use the cli with docker like so?

I’m trying something like:

docker run --rm -i -v html:/srv:rw wordpress:cli wp search-replace 'http://example.test' 'http://example.com' --path='html' --skip-columns=guid

Result:

Error: This does not seem to be a WordPress installation. Pass
–path=path/to/wordpress or run wp core download.

My docker-compose:

version: '3.3'

networks:
  ssl-reverse-proxy:
    external: yes

services:
   db:
     image: mysql:5.7
     container_name: ddd_db_dev
     volumes:
       - db_data:/var/lib/mysql
       - ./data:/docker-entrypoint-initdb.d # where to find our data
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: aaaa
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: aaaa

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     container_name: ddd_wordpress_dev
     volumes: # this is where we tell Docker what to pay attention to
      - ./html:/var/www/html # mapping our content to the container
     networks:
      - default
      - ssl-reverse-proxy
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: aaaa

volumes:
    db_data:

Source: StackOverflow