How to set volume for dokku-persistent-storage How to set volume for dokku-persistent-storage docker docker

How to set volume for dokku-persistent-storage


I am not into Ruby or dokku, but if I understood correctly, you want your docker to have a persistent storage on the host machine.

PERSISTENT_STORAGE file, as to the documentation that you've quoted, contains mappings from host file-system directories to your container file-system directories (translated to -v arguments of the CLI).

Therefore, you should map the directory of your uploads in the container, to the desired directory on the host.

For example, if your app's uploads are saved to this dir (inside the docker container):

/home/dokku/myapp/public_folder

and you'd like them to be kept in your host at:

/home/some/dir

then, as I understand, the content of PERSISTENT_STORAGE file should be:

/home/some/dir:/home/dokku/myapp/public_folder

I hope I got you right.


Use Dokku's storage:mount option.

  1. You'll need to SSH into your dokku host:ssh dokku@host

  2. Run the following command to link the storage directory for that app to the app/public/uploads folder, for example:

    storage:mount <app> /var/lib/dokku/data/storage:/app/public/uploads

The Dokku docs cover this well at: at http://dokku.viewdocs.io/dokku/advanced-usage/persistent-storage/