Backup a running Docker container?
Posted by one friend in comments
Hi Slava, sorry that your question was closed. For the record, Slava is talking about docker.io, a runtime for linux containers. Yes, docker export
is a suitable approach. It will generate a tarball of your entire container filesystem state, and dump it on stdout. So
docker export $CONTAINER_ID > $CONTAINER_ID-backup.tar
will yield a usable tarball. You can re-import the tarball with
docker import - slava/$CONTAINER_ID-backup < $CONTAINER_ID-backup.tar
Note the original metadata (eg id of the original image) will be lost. This should be fixed in future versions of docker.
– Solomon Hykes Apr 2 '13 at 6:35
Adding here so one can find from summary that question was answered. Thanks Solomon!
How to backup docker container with data and move to another server?
Docker, for default, stored images, containers, volumes, and other data, into /var/lib/docker
, if not customized by the file /etc/docker/daemons.json
as explained here.
In order to move all the graph to a new server you should:
- Stop docker service.
- Copy data root.
- Restart docker service.
Regards.
Backup/Restore a dockerized PostgreSQL database
Backup your databases
docker exec -t your-db-container pg_dumpall -c -U postgres > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore your databases
cat your_dump.sql | docker exec -i your-db-container psql -U postgres
Related Topics
Chrome Certificate Selection Appears Multiple Times
Printing an Integer with X86 32-Bit Linux Sys_Write (Nasm)
Aslr Bits of Entropy of Mmap()
Different Results Between Ps Aux and 'Ps Aux' Inside a Script
In Bash, Why 'X=100 Echo $X' Doesn't Print Anything
Join on First Column of Two Files
Sed: Insert a Line in a Certain Position
Bash Indirect Variable Reference
How to Use Grep to Match But Without Printing the Matches
How to Configure Bash to Handle Crlf Shell Scripts
Identifying Which Linux System Library Contains a Function
How to Fix "Go Not Root Owned"
Why Does the Wc Command Count One More Character Than Expected
Is Stack Memory Contiguous Physically in Linux
Linux. Sol_Netlink Not Defined
Remove File Coding Mark But Preserve Its Coding