Skip to content

Add note on use of wordpress:cli #1024

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions wordpress/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,53 @@ The following Docker Hub features can help with the task of keeping your depende

- [Automated Builds](https://docs.docker.com/docker-hub/builds/) let Docker Hub automatically build your Dockerfile each time you push changes to it.
- [Repository Links](https://docs.docker.com/docker-hub/builds/#repository-links) can ensure that your image is also rebuilt any time `%%REPO%%` is updated.

# wordpress:cli

wordpress:cli containers provide a means of manipulating wordpress in wordpress:alpine containers using [wp-cli](http://wp-cli.org/). Both containers must have read-write access to the files of the WordPress site. For example, run `docker-compose up` with the following docker-compose.yml:

```console
version: '3.1'

services:

wordpress:
image: wordpress:fpm-alpine
container_name: wordpress
domainname: docker
ports:
- 8080:80
environment:
WORDPRESS_DB_PASSWORD: example
volumes:
- "mysite:/var/www/html"


mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: example

wp-cli:
image: wordpress:cli
container_name: wp-cli
volumes:
- "mysite:/var/www/html"

volumes:
mysite:
```

Create the following `wp` alias:

```console
alias wp="docker-compose run --rm wp-cli"
```

Then the `wp` alias can be used to run [wp-cli](http://wp-cli.org/) commands e.g.

```console
wp core install --url="wordpress.docker" --title="A Test Blog" --admin_user="admin" --admin_password="password" --admin_email="[email protected]"
```

N.B. This will not work with the vanilla wordpress image, as www-data will have a different id in each container.