Persistent data docker

How can I check if my docker instance is using persistent data volume?

I am using docker inspect too.

I want to make sure I uderstand this 100% as the data is important.

This is what I use to build the docker instance:

app:
image: nextcloud:latest
container_name: nextcloud-app
networks:
- xxxxx
depends_on:
- letsencrypt
- proxy
- db
volumes:
- nextcloud:/var/www/html
- ./app/config:/var/www/html/config
- ./app/custom_apps:/var/www/html/custom_apps
- ./app/data:/var/www/html/data
- ./app/themes:/var/www/html/themes
- /etc/localtime:/etc/localtime:ro
environment:
- VIRTUAL_HOST=xxxxx
- LETSENCRYPT_HOST=xxxxx
- LETSENCRYPT_EMAIL=xxxxx
restart: unless-stopped

How can I uderstand this.

your data should be on your host in ./app/data. where . is the folder where your docker-compose file exists.

a ls -l ./app/data should show you all the files. and ls -l ./app/data/admin/files should show you all files of the default user “admin”.

your config looks right as @Reiner_Nippes stated before.

as the easiest proof I suggest following procedure:

  • upload the through Nextcloud (browser, client, WebDAV)
  • check the file system of your docker host ./app/data (where your docker-compose file lives)
    • new file should exists at ./app/data > [your user id] > [Nextcloud relative path to the file]
  • you could perform additional checks like rename and remove the file with Nextcloud client and monitor file system changes on docker host system.

Until you use encryption all Nextcloud files are are visible and accessible in [data root]/[user id] Meta-data like comments and shares are stored in the database should be checked/verified there…

as your data is important you may want to double check the official backup instructions

A persistent volume in Docker is one that’s named in the configuration, either a named Docker volume or a mount path on the host (the latter being what you have in your config). You can look (but don’t touch) in these folders on your host and see that the data is there. These folders will have that data in them even if you completely deleted your containers.

1 Like

@wwe @Reiner_Nippes @KarlF12 Tnx for the info much appreciated.

Now I need to find out about how to use named docker voiume’s in my config.

might be only wording:

everthing you use in the -v aka volumes: section is persistent on your host.

the difference is: if you use path name starting with / or ./ docker uses this path on the host. (aka bind mount)
if you use “only” a name like nextcloud docker will use a path below /var/lib/docker/... (aka named volume).

so the answer to your question: don’t put a / or ./ in the “name” of the volume.

https://docs.docker.com/storage/volumes/

1 Like

And you have some of both in your config already.