Skip to content
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

wp-env: Keep uploads on a Docker volume #32519

Open
ttencate opened this issue Jun 8, 2021 · 0 comments
Open

wp-env: Keep uploads on a Docker volume #32519

ttencate opened this issue Jun 8, 2021 · 0 comments
Labels
[Tool] Env /packages/env [Type] Enhancement A suggestion for improvement.

Comments

@ttencate
Copy link

ttencate commented Jun 8, 2021

What problem does this address?

After re-creating the Docker containers, for example after modifying .wp-env.json, the database is kept, but uploads are not. This surprised me. It is pretty annoying behaviour when working on a plugin that relies on uploaded images, because now the image files are all gone.

What is your proposed solution?

A persistent Docker volume could be mounted on /var/www/html/wp-content/uploads. This would work similarly to /var/lib/mysql in the MySQL container. These two volumes should probably be cleared at the same moments, because an upload without a corresponding database entry is fairly useless, and a database with entries for nonexistent uploads is also fairly useless.

With plain docker-compose, this feature would be trivial to add. I don't know anything about the internals of wp-env but I'm hoping it's similarly easy.

Workaround

Use "mappings" to put uploads in a directory on the host. This is imperfect at best, because they will end up owned by whatever user has ID 33 on the host system (which maps to www-data in the container).

@Mamaduka Mamaduka added the [Tool] Env /packages/env label Jun 9, 2021
@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] Env /packages/env [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants