Q: Date/Time this occurred (Provide your time zone also) A: October 17, 2023 at 1:46PM MT
Q: DevKinsta Version A: 2.11.0.7044
Q: OS Version A: macOS Sonoma 14.0
Q: Docker Desktop Version A: 4.24.2 (124339)
Q: Were any error codes or messages observed? If so, what were they? A:bash: less: command not found
Q: Detailed Description of the Problem A: I’m attempting to use WP CLI within devkinsta_fpm and am unable to run any WP-CLI commands that utilize less (including the help docs). When I attempt to do so, the console errors state that less is not found within the PATH.
You can replicate this by attempting to run wp help within the devkinsta_fpm container, like so:
$ docker exec --user www-data -it devkinsta_fpm wp help
sh: 1: less: not found
I was able to replicate the same on my end as well (I’m using Linux Ubuntu 22.04 and DevKinsta 2.11.0), so yeah I could confirm that less program is not available/included by default in that devkinsta_fpm container.
agus@Lenovo-IdeaPad-FLEX-15IWL:~$ docker exec --user www-data -it devkinsta_fpm /usr/local/bin/wp help
sh: 1: less: not found
agus@Lenovo-IdeaPad-FLEX-15IWL:~$ docker exec --user www-data -it devkinsta_fpm whereis less
less:
As a workaround, we could still install less inside that docker’s container (with root access)
I just did it and now could use the “wp help” command line .
So you could do the same as follow:
Go inside that devkinsta_fpm container with root user with this command line: docker exec -it devkinsta_fpm bash
Inside that devkinsta_fpm container (as root), make sure that you’re connected to the Internet and please type this: apt update
After that apt update process has completed, you can then type the following: apt install less
Then after the less program has been installed successfully inside that devkinsta_fpm container, you can just type: exit (to exit from that container).
Now you should be able to execute the previous command line from your terminal: docker exec --user www-data -it devkinsta_fpm wp help
and if you check with this command: docker exec --user www-data -it devkinsta_fpm whereis less
that should return with the following: less: /usr/bin/less
Oh wow! I should have taken a peek at the Dockerfile beforehand (… going to blame that on end-of-day-debugging )—would have quickly realized it’s an Ubuntu image, not Alpine (as I was trying apk add less).
Cool, thank you! I have passed your suggestion to our internal team, see if they can review this and make an update to that documentation page in question when necessary!