2

I had a running Docker container on a computer.

The computer crashed due to a power failure. The disk started up right etc, and now I want to go somehow go to the container and "salvage" the data from there. I know the container ID.

I can see the diffs in /var/lib/docker/aufs/diff ; however, I need the whole filesystem as it was during the crash, if possible.

In /var/lib/docker/aufs/mnt, I don't see a thing.

When I tried to run another docker with --with-volumes (ID), I see nothing there.

How to get to the actual data, as they were during the crash?

2 Answers 2

3

I am not sure if it's "the right way", but this helped me.

docker commit (ID of the crashed container)

This creates a new image out of the crashed container and gives me its ID. Now I just have to run the new image...

docker run -ti (ID of the new image)

and I can now safely salvage the data.

1
  • To identify the crashed container: $ docker container ls --all, can also just $ docker start -ai <crashed container ID>
    – user73120
    Commented Oct 29, 2020 at 20:28
0

Posting this here as well for easy of googling. Originally posted here.

The easiest way I've found for copying from a non-functional container is docker cp.

docker cp <container-name>:<path/inside/container> <path/on/host/>

Thanks to docker cp (link) you can copy directly from the container as it was any other part of your filesystem. For example, recovering all files inside a container:

mkdir /tmp/container_temp
docker cp example_container:/ /tmp/container_temp/

Note that you don't need to specify that you want to copy recursively.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .