I have question regarding volumes and ownership.
As an example I'm using this image: privatebin, but this is the same for any case.
First I'm creating volume:
$ docker volume create privatebin-data
From docker inspect, I can see where data is located:
$ docker inspect privatebin-data
[
{
"CreatedAt": "2018-12-04T21:42:46+01:00",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/privatebin-data/_data",
"Name": "privatebin-data",
"Options": {},
"Scope": "local"
}
]
Following instructions from docker hub, I'm starting image:
$ docker run -d --restart="always" --read-only -p 8080:80 -v privatebin-data:/srv/data privatebin/nginx-fpm-alpine:1.1.1
Then I visit http://localhost:8080 and everything is working as expected.
Content of volume now:
$ ls -l /var/lib/docker/volumes/privatebin-data/_data
total 16
drwx------ 3 82 82 4096 Dec 4 21:49 73
-rw-r----- 1 82 82 46 Dec 4 21:49 purge_limiter.php
-rw-r----- 1 82 82 529 Dec 4 21:49 salt.php
-rw-r----- 1 82 82 131 Dec 4 21:49 traffic_limiter.php
I want to backup directory by archiving it:
tar -C /var/lib/docker/volumes/privatebin-data -czf privatebin-data-backup.tar.gz _data
My question is: Can I safely assume that if I restart image, for example on other server, user and group owner will still be 82? Is this proper way of backuping and restoring docker volumes?