0

I'm new to wordpress. I'm trying to get it running in a docker stack.

I want to mount a named volume like so

-v wordpress_data:FOO

But I'm unsure what to use for FOO as I don't understand how wordpress stores its data.

What is the difference between /var/www/html/ and /var/www/html/wp-content/?

1 Answer 1

1

If you're running the official wordpress image from dockerhub, the docs advise mapping a volume to /var/www/html inside the container.

So your flag would look like:

-v wordpress_data:/var/www/html

What is the difference between /var/www/html/ and /var/www/html/wp-content/?

wp-content is just a subdirectory of the wordpress installation, which is created on first run. A number of other files can be found alongside it in this directory:

# ls /var/www/html
index.php    wp-blog-header.php    wp-includes    wp-settings.php
license.txt  wp-comments-post.php  wp-links-opml.php  wp-signup.php
readme.html  wp-config-sample.php  wp-load.php    wp-trackback.php
wp-activate.php  wp-content        wp-login.php   xmlrpc.php
wp-admin     wp-cron.php           wp-mail.php
2
  • Thanks for the reponse. Though I know it's a subdirectory :-) My point is what is the difference between them? Which should be backed up for example? Which is ephemeral and can be ignored... Where does the config live, etc. I don't know the difference between them, but I've seen enough docker config examples to realise there is an important distiction between them, I just don't know what it is
    – lonix
    Oct 19, 2019 at 15:10
  • I've found it hard to find a definitive source on this. wp-content should be persisted, as it contains themes, plugins & user uploads. There is a discussion relating to this which advises persisting only wp-content, so that the remainder of the files will be updated when an updated image is pulled. It sounds like the config file wp-config.php is built by env vars which are documented on the dockerhub site, so I don't think you'd need to back this up. Probably worth testing this yourself though.
    – v25
    Oct 19, 2019 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .