Skip to content

Instantly share code, notes, and snippets.

@reidransom
Created February 14, 2025 14:45
Show Gist options
  • Save reidransom/a9d0843ae78f87a08a6f6a1e7bf40904 to your computer and use it in GitHub Desktop.
Save reidransom/a9d0843ae78f87a08a6f6a1e7bf40904 to your computer and use it in GitHub Desktop.
Here's one way to move docker volumes from host to host which comes in handy for me as I tend to change my workstation often.
# Backup/export docker volume to tar archive
docker run --rm -v pgdata:/in -v ./:/out ubuntu tar cvf /out/pgdata.tar /in
# Restore docker volume from tar archive
docker run --rm -v pgdata:/out -v ./:/in ubuntu bash -c "cd /out && tar xvf /in/pgdata.tar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment