New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include WP-CLI in all WordPress images #283

Open
mvasin opened this Issue Feb 23, 2018 · 9 comments

Comments

Projects
None yet
9 participants
@mvasin
Copy link

mvasin commented Feb 23, 2018

For a while now, WP-CLI has become the official way to manage WordPress from scripts / command line.

But if you glance through docker-entrypoint.sh, the current way of installing WordPress and hacking wp-config.php with sed and awk is not pretty and error-prone compared to a bunch of WP-CLI commands like

wp core download
wp config set
wp core install

WP-CLI doesn't take too much space, and it's become essential. I propose to:

  • include WP-CLI in all official WordPress images,
  • deprecate the stand-alone WP-CLI image,
  • refactor docker-entrypoint.sh using WP-CLI.

It will show the community the relevant way of managing WordPress from the command line, and will make it easier to actually use the image later on. It will also solve #256.

@ConstantinElse

This comment has been minimized.

Copy link

ConstantinElse commented Jun 22, 2018

Having the same problem. It would be nice to be included in WP image.

@yosifkit

This comment has been minimized.

Copy link
Member

yosifkit commented Jun 22, 2018

While it is a great tool, it is not included in the image for a number of reasons:

  • it is not the canonical way to install wordpress (https://codex.wordpress.org/Installing_WordPress)
  • it cannot be removed; some users won't need it
  • the cli image can be used to manage a wp installation in another container
    $ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:5.7
    2bc33cf6d0f63ddd04ab46af874aac441377d9878ed3de303354e6a53ce82a2f
    $ docker run --name some-wordpress --link some-mysql:mysql -p 8080:80 -d -e WORDPRESS_DB_PASSWORD=my-secret-pw wordpress
    dc783a30d5a4e546e74f0b9c3a04312c1b7d107208dd0fc97aea1770ee100454
    $ docker run -it --rm \
    >     --volumes-from some-wordpress \
    >     --network container:some-wordpress \
    >     wordpress:cli user list
    Error: The site you have requested is not installed.
    Run `wp core install` to create database tables.
    $ # ran through setup in browser
    $ docker run -it --rm     --volumes-from some-wordpress     --network container:some-wordpress     wordpress:cli user list
    +----+------------+--------------+-----------------+---------------------+---------------+
    | ID | user_login | display_name | user_email      | user_registered     | roles         |
    +----+------------+--------------+-----------------+---------------------+---------------+
    | 1  | asdf       | asdf         | abc@example.com | 2018-06-22 21:42:02 | administrator |
    +----+------------+--------------+-----------------+---------------------+---------------+
@mvasin

This comment has been minimized.

Copy link
Author

mvasin commented Jun 23, 2018

@ConstantinElse

This comment has been minimized.

Copy link

ConstantinElse commented Jun 23, 2018

Personally, I use it for managing users, roles, and plugin activation/dectivation from CLI. I agree that:

  1. It's a small utility in comparison to WP.
  2. Having to deploy a separate container just for this - by me it's an overkill.
  3. As part as WP containers build and automation I don't like the idea that to activate plugins (from CLI) - I need to run another container ... just because the wp-cli is missing
@barcia

This comment has been minimized.

Copy link

barcia commented Sep 23, 2018

Yes, I also found it very useful! And I think that is lightweight and really is not intrusive for people that not use it.

@aseempatni

This comment has been minimized.

Copy link

aseempatni commented Oct 5, 2018

Any updates on this? Are there any plans to include wp-cli in WordPress docker images?

@alexstandiford

This comment has been minimized.

Copy link

alexstandiford commented Oct 29, 2018

I too am interested to see. Currently using a variant just to get CLI running. Feels like this should be baked in.

@davilera

This comment has been minimized.

Copy link

davilera commented Dec 14, 2018

I also agree. I feel like anyone who's using Docker to manage WordPress installations is very, very likely to use CLI too.

@darrenbarklie

This comment has been minimized.

Copy link

darrenbarklie commented Dec 15, 2018

I also anticipated this being built in. Considering the barrier to entry is understanding and using Docker, WP CLI would be a justifiable inclusion for devops workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment