`10updocker wp snapshots` is not recognized as a registered wp command on WSL2
Troubleshooting
- [X] I have attempted to troubleshoot this already
Describe the bug
On WSL2 (Ubuntu), I had some trouble working with snapshots and v.4.* of wp-local-docker-v2.
I tested this on a clean install on a new machine, so I've installed v.4.0.0 directly (no upgrade from previous version). When I try to run any 10updocker wp snapshots command, I get the error:
Error: 'snapshots' is not a registered wp command. See 'wp help' for available commands.
I tried running 10updocker image update, as well as updating docker-compose.yml as per the instructions, but the same error persisted. I tried running different image configurations, like for example running it from sites with different PHP versions, but I always got the same error.
It's worth noting that Ubuntu suffixes the images with my WSL username (which is gsarig), so at first, when I checked my image in docker-compose.yml, it looked like this: wp-php-fpm-dev-8.0-gsarig. When I ran 10updocker image update, the update ran, but I got a message like:
ℹ 10up/wp-php-fpm-dev:8.0-ubuntu doesn't exist on this system. Skipping update...
To fix it, I ran docker pull 10up/wp-php-fpm:8.0-ubuntu to pull the PHP image, and then manually update docker-compose.yml to use it.
Still this had no effect, as I kept getting the same error every time I tried to run 10updocker wp snapshots (that it's not a registered command).
After failing to set it up, I tried to use the old wpsnapshots with v.4 of wp-local-docker. While it works fine when it comes to connecting, finding and pulling the snapshots, it failed to actually set up the snapshot. The message I got, during the setup, was this:
The snapshot is ready, please, can you confirm that you want to apply it? It is a potentially destructive operation, please, run a back up first. (y/N) y Pulling database... Decompressing database backup file... /usr/bin/env: 'mysql': No such file or directory Could not set MySQL max_allowed_packet. If MySQL import fails, try running WP Snapshots using root DB user. Updating database. This may take awhile depending on the size of the database (271.62 MB)... /usr/bin/env: 'mysql': No such file or directory
I believe that it's because it tries to connect with the server's php and not with the container's. If I try to run it with 10updocker wpsnapshots pull, I get the earlier error:
Error: 'snapshots' is not a registered wp command. See 'wp help' for available commands.
In the end, I had to downgrade to v3, in order to be able to use the old snapshots.
Steps to Reproduce
- Using WSL2, install the
wp-local-docker-v2 - Create a new project
- Try to use
10updocker wp snapshotsin it using any command. - Notice that the command is not recognized as a registered wp command, even though wp-cli works fine for other commands.
Screenshots, screen recording, code snippet
No response
Environment information
- Device: Surface Pro 8
- OS: Windows 11 / WSL2 (Ubuntu LTS)
- Docker Desktop version: 4.21.1
Code of Conduct
- [X] I agree to follow this project's Code of Conduct