Restarting docker / how to import sqlite database

I’m running farmos in a docker container using

docker run --rm -p 80:80 -v "${PWD}/siterun --rm -p 80:80 -v “${PWD}/sites:/opt/farmos/sites” farmos/farmos:3.1.2 &

When I stop and restart the container it won’t use my sqlite database even though the path seems correct and I have a .ht.sqlite file there. It seems like it is a fresh install every time. I have used the same username and password also.

Any thoughts on getting farmos to either restart gracefully or import the existing sqlite db?

1 Like

Welcome @ricardo! :smile:

It may be a problem with your volumes. Generally speaking, the minimum volume you need is /opt/drupal/web/sites (that’s the path inside the container).

I’m not sure what your -v "${PWD}/siterun volume is for (also it seems to be missing the closing double quote?).

And the -v “${PWD}/sites:/opt/farmos/sites” is not correct. But maybe if you change it to -v “${PWD}/sites:/opt/drupal/web/sites” it would work.

Hope that helps!

Hi @mstenta

Thanks for the reply. Apologies, I had a typo in the docker command I posted. Actual command I have been using is:

docker run --rm -p 80:80 -v “${PWD}/sites:/opt/farmos/sites” farmos/farmos:3.1.2 &

I think /opt/farmos/sites is correct as that is the directory structure I used & that’s how I had it running for the last couple of weeks.

Try changing /opt/farmos/sites to /opt/drupal/web/sites. I bet that will solve your problem. :slight_smile:

That is what is used in all of the examples on farmOS.org and in our repository:

I could go into more detail about what /opt/farmos actually is for if you’re interested, but for the sake of this topic I’ll just say “trust me”. :smile:

:rofl: :rofl: :rofl:

Thanks so much @mstenta of course the issue was between the keyboard and the chair!!

FarmOS has now started perfectly and I can see my data again - getting the login prompt instead of the fresh install. New user but I’m really getting to love this farm management tool.

1 Like

Hooray! Glad to hear it @ricardo! Welcome to the community! :smile: