patterndockerMinor
Getting data from crashed docker container
Viewed 0 times
containerdockercrashedgettingfromdata
Problem
I am having docker container with Ubuntu installed which was running with Nvidia docker
But now I connected that HDD in a different computer. Now After typing
following command in newly assembled system
sudo docker start container
I am getting error something like
Unable to create /etc/nvidiactl
It seems like it needs Nvidia GPU to run that container which I don't have. So how can I get the data which is there in the container if i am unable to start it?
But now I connected that HDD in a different computer. Now After typing
following command in newly assembled system
sudo docker start container
I am getting error something like
Unable to create /etc/nvidiactl
It seems like it needs Nvidia GPU to run that container which I don't have. So how can I get the data which is there in the container if i am unable to start it?
Solution
So what you can do is you list all of your containers with command:
And the second field is an image name, you can run this command to get all the read-only layers with their respective directories to search for the file in:
If the file was something written inside the container replace Lower with Upper.
In case you are on Mac the /var/lib/docker is inside the virtual machine and so you have to first enter that before you can get to those directories described in the command above. You can do it using nsenter like this:
docker container ls -aAnd the second field is an image name, you can run this command to get all the read-only layers with their respective directories to search for the file in:
docker image inspect | jq '.[0].GraphDriver.Data.LowerDir' -r | tr ":" "\n"If the file was something written inside the container replace Lower with Upper.
In case you are on Mac the /var/lib/docker is inside the virtual machine and so you have to first enter that before you can get to those directories described in the command above. You can do it using nsenter like this:
docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i shCode Snippets
docker container ls -adocker image inspect <image_id> | jq '.[0].GraphDriver.Data.LowerDir' -r | tr ":" "\n"docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i shContext
StackExchange DevOps Q#4860, answer score: 2
Revisions (0)
No revisions yet.