Less is unavailable within devkinsta_fpm container, breaks WP CLI

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

Hi @colby.l :wave:

Thank you for your report! We’ll review this and provide you with further updates as soon as possible

I’m able to replicate on macOS 13.6 (Ventura) on 2.11.0 DevKinsta, and Docker Desktop version 4.24.2

Best regards,
Zach

Hey @colby.l :wave:

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) :smile:
I just did it and now could use the “wp help” command line .

So you could do the same as follow:

  1. Go inside that devkinsta_fpm container with root user with this command line:
    docker exec -it devkinsta_fpm bash

  2. Inside that devkinsta_fpm container (as root), make sure that you’re connected to the Internet and please type this:
    apt update

  3. After that apt update process has completed, you can then type the following:
    apt install less

  4. Then after the less program has been installed successfully inside that devkinsta_fpm container, you can just type: exit (to exit from that container).

  5. 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

Hope that helps! :smiley:

regards,
Agus

1 Like

Oh wow! I should have taken a peek at the Dockerfile beforehand (… going to blame that on end-of-day-debugging :sweat_smile:)—would have quickly realized it’s an Ubuntu image, not Alpine (as I was trying apk add less).

You may want to update this documentation page on WP-CLI with DevKinsta—it doesn’t mention that only certain WP-CLI commands will work out-of-the-box and led me to reporting this as a bug. :sweat_smile:

Thanks so much for the quick clarification & steps to mitigate!

1 Like

You’re most welcome @colby.l ! :bowing_man:

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! :smiley:

regards,
Agus

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.