File Storage

In Dokku-enabled environments, application code is compiled into a Docker image during the deployment phase. This image is then used as the basis for running a containerized instance of your application. Any file-related changes inside the container are not preserved between deployments.

If you need to persist files - for example, documents uploaded by users - you'll need to create a directory in the virtual machine's filesystem and allow your Dokku application to access this location.

First define a storage location:

dokku storage:ensure-directory my_app

This creates a directory at /var/lib/dokku/data/storage/my_app in the virtual machine's filesystem. Next, use the Dokku mount command to map the storage directory to a path that will be accessible by your app inside the runtime container. Inside the container, your application is located at /app. The following example allows your application to access files locally under /app/storage.

dokku storage:mount my-app \

Update your application's configuration so that any dynamic content is stored under /app/storage (in production) and re-deploy (git push) or restart (dokku ps:restart) your application.

Note: if your application complains about permissions when attempting to read files from the storage directory, run the following command once to update the ownership of the file to match the identity used by the container:

sudo chown -R 32767:32767 \

Amazon S3 Cloud Storage

We recommend using Amazon S3 for storing dynamically generated content such as images, videos, PDFs, etc. The cost of S3 is about six times less per 100GB vs. local storage. Please contact us to provision an Amazon S3 bucket.

Healthcare Blocks enables at-rest encryption of managed S3 buckets by default. However, only file data is encrypted - file names are not encrypted - meaning you should not any personal identifiers in the names of objects.

Shared Network Storage

Healthcare Blocks can provisioned shared network storage (as an alternative to Amazon S3) that is encrypted at rest and in transmission of files. This filesystem can be attached to multiple virtual machines. Please create a help desk ticket for assistance.