Recover file from dockge container in snapshot

Hi guys,
TrueNAS / docker newbie here.
I am building my first TrueNAS box, and I have been trying to finish off the hardware. Yesterday I took some snapshots of my main TrueNAS filesystem and moved it from a raidZ1 configuration to a striped mirror. All went fine and I am now running off my new drives. Today I was working on my fan speed controller bash script. This was built inside a docker container in dockge. I am a total n00b with docker, and I have broken the container, and seem to have lost the script I wrote. I have now learnt that I shouldn’t be writing scripts inside a running container…

Now I have several snapshots of this filesystem, I have spent a few hours and tried to look around but I can’t find where the actual containers are stored.
I think I have found containers in /mnt/.ix-apps/docker/overlay2/ , but this is my running system, but I can’t seem to locate my script in anything located there.

I assume my script should still exists in one of my snapshots?
Is there a way to recover this file?

Thanks in advance

Depends, did you take snapshots of the ix-apps dataset?

Wow, thanks for the fast reply.

To be honest I don’t know?
I have created 2 data sets. One on flash, and one on spinning disks.
The flash based one is my main one and is where I store everything, and I only have movies on the spinning disk.

I believe I took a snapshot of the top level of the whole flash based dataset.

If there is a separate ix dataset located somewhere else then I didn’t explicitly take a snapshot of that.

Essentially, docker containers consist of a bunch of layers of “overlay” filesystems, and the top layer is a temporary writable file system that gets thrown away when the container is updated.

If you took a snapshot of the hidden ix-apps dataset, that is where the docker directory is, and where all the file systems are located.

In the snapshot, you should theoretically be able to do a find/grep for your script, assuming you know its name.

There is a ix-apps directory in my snapshot, but it is empty.

I followed

forums truenas com/t/solved-step-by-step-process-to-migrate-or-upgrade-a-pool-e-g-2-disks-4-disks/2893

to migrate the data from one set of disks to another, and then I had to follow

forums truenas com/t/pool-swap-replicated-pool-and-ix-apps-mount-point-problem/22869
to get my apps to work again after I migrated the pool.

if the ix-apps directory in my snapshot is empty should I be looking somewhere else for my data?

I just tried running a find in my snapshot directory, but no luck.

Looks like I need to write it from scratch.

In the future how should I backup .ix-apps ?

The TrueNAS process is to store things you want to keep in a Host Path or similar.
Do not store things inside a container or inside a iXvolume residing in .ix-apps. Those places are volatile and thus unsuited for important data.

A Host Path dataset is easily replicated using normal means.

Thanks guys for your help. I didn’t loose anything (actually I spent more time trying to find my script, than it took me to rewrite it.) With the advise given to me I have learnt a lot more about docker, and I realized I had done quite a few things incorrectly. So in then end it turned out that this was a happy little accident.

2 Likes