[Solved] Restore Docker settings after docker.img deletion?


walle

Recommended Posts

For some reason my cache pool got corrupted today (thx 2020) and I ended up with using btrfs restore, format and restore the pool. When I tried to start the Docker service again got the following message:

Quote

Your existing Docker image file needs to be recreated due to an issue from an earlier beta of Unraid 6. Failure to do so may result in your docker image suffering corruption at a later time. Please do this NOW!

So I deleted the docker.img-file, started the service and I'm currently adding the containers from my templates.

 

However it seems that my Docker network settings are gone and therefor a few containers can't run properly because of missing my custom network types.

Is there a way to restore these network settings, or at least a way to recreate it? Also it would be nice if I can get my hands on the metadata of the Docker containers such as autostart settings etc, but the main part is networking settings.

Edited by walle
Mark it as solved
Link to comment
25 minutes ago, trurl said:

The custom docker networks need to be recreated the same way you created them originally. Once the custom networks exist your templates will use them. How did you know what to do when you created them before?

That’s the basically the issue, I don’t remember what networks I did setup and what guides I followed. I will probably able to figure that out soon as I get some sleep (currently 4 am). I still have the corrupted docker.img, so if it’s possible to recover the information from it I will give it a try.

 

Also, if there is a way to back up Docker metadata other than backup docker.img file, let me know. Or if it’s ok to back it up anyway even if it’s mostly unnecessary and space inefficient to do so.

Link to comment
On 1/1/2021 at 4:44 PM, trurl said:

You can examine the template XML of each of your dockers to see the name of the custom network it was using. Your templates are on flash in config/plugins/dockerMan/templates-user 

Yeah, but in my case I also need to know what driver I did use and that's why I needed the network config. But thanks anyway.


Anyhow after another server crash (🤮), fix the most likely cause of the error, recover the data again and lastly fixed mayor issues with some containers I finally had time to reconfigure the networking. It was a bit of a pain, but if this happens again I have now at least metadata backup of the config thanks to this simple scheduled user script I run every night:

#!/bin/bash
BACKUP_PATH=/mnt/user/backup/system/metadata

docker network ls > "${BACKUP_PATH}/docker_network.txt"
docker images --digests > "${BACKUP_PATH}/docker_images.txt"
docker ps > "${BACKUP_PATH}/docker_ps.txt"

Besides the networking info, I also added other useful info that can come in handy such as be able to fetch specific image version instead of try to fix the latest image.

Edited by walle
  • Thanks 1
Link to comment
  • 3 months later...
1 hour ago, sonic6 said:

@walle thanks for sharing your script, i will use it. i am not very into scripting.

 

maybe theres a way to backup the Network settings from /mnt/user/system/docker/container/network/ ?

Unfortunately no what I'm aware of, all information is contained in the /mnt/user/system/docker/docker.img file and the easiest way to get any meta information from this file is running docker CLI commands. If you read the content of my script, it's basically the same docker commands that you would normally write in a terminal. I don't think there is any similar way than this unless someone either creates a plugin or be part of some backup plugin/tool. Anyhow, just install User script plugin, if you not already have it, and copy paste the script, change path and you are done. :)

  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.