-
Set variable for your data mounts:
DOCKER_VOLUME=/media/docker/volume
NOTE: This is fairly generic in that my
joplin-data
is mounted at/media/docker/volume/joplin-data
, so set the variable to wherever you keep your data mounted. -
Create a backup of the database:
docker exec joplin-db /bin/bash -c '/usr/bin/pg_dump -Fc -U joplin joplin' > ${DOCKER_VOLUME}/joplin-data/backup.dump docker kill joplin-db joplin-server
-
At this point, move the mounted directory to some place else. For example:
mv ${DOCKER_VOLUME}/joplin-data ${DOCKER_VOLUME}/joplin-data-pg13
-
Update the Postgres version in the docker-compose.yml file. Example:
joplin-db: image: postgres:16
NOTE: Reference the sample docker-compose.server.yml file to find the latest supported database version.
-
Run the new image and allow the file structure to be created
docker compose up -d --force-recreate joplin-db joplin-server
-
Once the database is up and ready to accept connections (you can check this by viewing the logs), go ahead and copy the
backup.dump
file into the new volume mount, and import the database from the backup you created in step 1.cp ${DOCKER_VOLUME}/joplin-data-pg15/backup.dump ${DOCKER_VOLUME}/joplin-data/ docker exec joplin-db pg_restore --clean -U joplin -d joplin /var/lib/postgresql/data/backup.dump
-
You're now running the latest supported version of PostgreSQL with Joplin, and all your notes are intact.