title: Backup and restore docker named volume
body: <p>I have question regarding volumes and ownership.</p>
  
  <p>As an example I'm using this image: <a href="https://hub.docker.com/r/privatebin/nginx-fpm-alpine/" rel="noreferrer">privatebin</a>, but this is the same for any case.</p>
  
  <p>First I'm creating volume:</p>
  
  <pre><code>$ docker volume create privatebin-data
  </code></pre>
  
  <p>From docker inspect, I can see where data is located:</p>
  
  <pre><code>$ 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"
      }
  ]
  </code></pre>
  
  <p>Following instructions from docker hub, I'm starting image:</p>
  
  <pre><code>$ docker run -d --restart="always" --read-only -p 8080:80 -v privatebin-data:/srv/data privatebin/nginx-fpm-alpine:1.1.1
  </code></pre>
  
  <p>Then I visit <a href="http://localhost:8080" rel="noreferrer">http://localhost:8080</a> and everything is working as expected.</p>
  
  <p>Content of volume now:</p>
  
  <pre><code>$ 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
  </code></pre>
  
  <p>I want to backup directory by archiving it:</p>
  
  <pre><code>tar -C /var/lib/docker/volumes/privatebin-data -czf privatebin-data-backup.tar.gz _data
  </code></pre>
  
  <p>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?</p>