I have created a container with Postgres and a volume for pgdata. I want to be able to backup and recover the database data easily with btrfs snapshots. For this purpose I have mapped the pgdata folder to a subvolume like this (using run not create!):
I can do a snapshot after I have stopped the container without problems but when I try to start the container again the container is exiting immediately. I suppose the reason is docker is trying to recreate the volume from scratch and fails. So how can I tell or Postgres to use the existing pgdata btrfs subvolume? How I can tell docker or an app in general to use an existing volume?