I have (had) a data container which has a volume used by other containers (--volumes-from).
The data container has accidentally been removed.
Thankfully the volume was not removed.
Is there any way I can re run the data container and point it BACK to this volume?
Not entirely sure but you might try
You should then be able to access the directory, i think.
When I came to this question, my main concern was data loss. Here is how I copied data from a volume to AWS S3:
Alternatively you can use
aws s3 sync
.MySQL / MariaDB
My specific example was about MySQL / MariaDB. If you want to backup a database of MySQL / MariaDB, just execute
You might also want to consider
--skip-add-drop-table
: Skip the table creation if it already exists. Without this flag, the table is dropped.--complete-insert
: Add the column names. Without this flag, there might be a column mismatch.To restore the backup:
Sure, I detailed it in "How to recover data from a deleted Docker container? How to reconnect it to the data?"
You need to create a new container with the same VOLUME (but its path
/var/lib/docker/volumes/...
would be empty or with an initial content)Then you move your legacy volume to the path of the volume of the new container.
More generally, whenever I start a data volume container, I register its volume path in a file (to reuse that path later if my container is accidentally removed)