Running Acorn CMDs Inside Docker Container

Straight off the bat I’ll admit I’m a total n00b when it comes to docker however at the point I’m a bit lost and I need some help.

I’ve create a docker compose file that spins up WP the DB and the WPCLI. I run my cli commands as such: - docker-compose run --rm wpcli plugin list to list the currently installed plugins.

However one issue I’m having is when I run docker-compose run --rm wpcli acorn help I get : -

/usr/local/bin/docker-entrypoint.sh: exec: line 11: acorn: not found
ERROR: 127

I’ve installed Acorn as a plugin but I don’t have a clue how this relates to docker and I’m feeling a bit lost.

Anyone help?

1 Like

Even if Acorn is activated as a plugin it still needs to be booted

Example from the Sage theme

Thanks for the reply Ben!

Hmmm I’m not sure … I’ve installed acorn via composer and a plugin… just to see if it works and then dumping var_dump(\Roots\bootloader()) all I get is NULL returned.

I also tested this on a mamp stack and going either the plugin/composer route it works fine it’s just something in docker causing things to totally bork :frowning:

Is there a git repo you could push up for us to try out and reproduce?

Hopefully, it is not too late to provide an answer.
I was having the same problem. Basically, we run wp cli in a different container then the server/WordPress. So, whenever wpcli runs it will look up folders that volume, or shared folders between containers. For instance, this is what my wpcli image looks like in my docker-compose.yml:

  wpcli:
    image: wordpress:cli-php8.1
    volumes:
      - ./custom.ini:/usr/local/etc/php/conf.d/custom.ini
      - ./wp-app:/var/www/html:delegated
      - ./wp-content/themes/:/var/www/html/wp-content/themes:delegated
      - ./wp-content/plugins/:/var/www/html/wp-content/plugins:delegated
      - ./wp-content/uploads/:/var/www/html/wp-content/uploads:cached
    environment:
      VIRTUAL_PORT: 8088
      WORDPRESS_DB_HOST: database:3306
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
      WORDPRESS_DB_NAME: wordpress
    depends_on:
      - database
      - wordpress

One other thing to bear in mind is folder and files permissions. One container might have access to one certain folder, but other might not. For that reason check if folders that have been volumed out have read and write access to all. If not chmod -R 777 ./<folder_name>.
Last but not least, certify you have acorn installed by re-running composer require roots/acorn.

1 Like