Can you share a little more information about your Docker hosting setup? You mentioned you’re using Plesk in another thread - correct?
I’m not familiar with Plesk, so I’m not sure how much help I can be. But the basic idea of Docker is that it “containerizes” a service, which makes it “ephemeral” - so you can create/destroy the container quickly/easily. Naturally that means that if you are storing any data within the running container, it gets lost when the container gets destroyed. So, you set up “volumes” - directories that are mounted from a specific path on the host into a specific path inside the container - for any data that needs to be “persisted” outside of the container lifecycle.
In the case of farmOS (Drupal), best practice is to persist the whole sites
directory. In the farmOS Docker container, that is in /opt/drupal/web/sites
. This includes both uploaded files as well as the settings.php
file which stores database connection credentials. (So FYI if you aren’t already persisting those, then when you shut down your container it will lose connection to the database.)
Docker Compose is one way to run containers. Our example docker-compose.production.yml
file shows the volume mount here: farmOS/docker-compose.production.yml at 616261498d87103eba3651254ac25f9f4cfd0f36 · farmOS/farmOS · GitHub
volumes:
- './sites:/opt/drupal/web/sites'
What that means is: “take the sites
directory (that is in the same directory as the docker-compose.yml
file), and mount as a volume so it’s available at /opt/drupal/web/sites
inside the container.”
You will need something similar.
If you currently have /docker/farmos/drupal/web/sites/default/files
on your host system, I would recommend mounting /docker/farmos/drupal/web/sites
into the container as /opt/drupal/web/sites
.
It’s up to you where you keep the directory outside the container. But inside the container it needs to be available at /opt/drupal/web/sites
, assuming you are using the standard farmOS Docker image.
Speaking of: what Docker image are you using?
We recommend that you use a specific version (eg: farmos/farmos:2.0.0-beta7
), and not latest
or 2.x
(and especially not 2.x-dev
in production deployments).