title: How to restore a redis backup in a redis container?
body: <p>I have a redis container. I would like to back it up and reimport the backup on another machine in another redis container.</p>
  
  <p>I followed theses steps:</p>
  
  <pre><code># Create the original redis container
  docker run --name redis -d redis:3.0.3 redis-server --appendonly yes
  
  # add a key inside it for the tests
  docker run -it --link redis:redis --rm redis sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT"'
  &gt; SET foo bar
  OK
  
  # backup this container
  docker run --volumes-from redis -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /data
  
  # I now have a backup.tar file on my system and I transfer it on another machine
  # Recreate a redis container
  docker run --name redis2 -d redis:3.0.3 redis-server --appendonly yes
  
  # restore the backup
  docker run --volumes-from redis2 -v $(pwd):/backup ubuntu sh -c "cd / &amp;&amp; tar xvf /backup/backup.tar"
  
  # check if the backup has been correctly restored
  docker run -it --link redis2:redis --rm redis sh -c 'exec redis-cli -h "$REDIS_PORT_6379_TCP_ADDR" -p "$REDIS_PORT_6379_TCP_PORT"'
  &gt; GET foo
  (nil)
  </code></pre>
  
  <p>The backup is not restored properly. What am I doing wrong?</p>