<p>So what you can do is you list all of your containers with command:</p>

<pre><code>docker container ls -a
</code></pre>

<p>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:</p>

<pre><code>docker image inspect &lt;image_id&gt; | jq '.[0].GraphDriver.Data.LowerDir' -r | tr ":" "\n"
</code></pre>

<p>If the file was something written inside the container replace <strong>Lower</strong> with <strong>Upper</strong>. </p>

<p>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:</p>

<pre><code>docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
</code></pre>

CC BY-SA 4.0
2018-08-29T15:48:42.797Z
2018-08-29T15:48:42.797Z
Jiri Klouda
<p><em>This answer assumes a completely broken installation, i.e. no <code>docker xxx</code> commands work (though the OP did not say that explicitely). If I guessed wrong and they do work, then please refer to Jiri Klouda's answer instead.</em></p>

<p>Docker manages all the data in <code>/var/lib/docker</code>. Look around, you should immediately be able to find it. The top level directory names are hashes, and thus look pretty garbled, but below that you have the regular file system(s) of your images and containers. All those "onionized" filesystem layers will still be there if you didn't delete them. You can search using the usual command line tools (<code>find</code> etc.), filtering by date, file size, file name, etc.</p>

CC BY-SA 4.0
2018-08-28T16:31:05.023Z
2018-08-29T16:20:00.690Z
2018-08-29T16:20:00.690Z
AnoE
<p>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</p>

<blockquote>
  <p>sudo docker start container</p>
</blockquote>

<p>I am getting error something like
Unable to create  /etc/nvidiactl</p>

<p>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?</p>

<docker><containers><linux>
Getting data from crashed docker container
Mangesh Divate
# Getting data from crashed docker container

(Asked by: username_0 on 2018-08-28)

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?

**Tags:** docker, containers, linux


---

## 2 answers

### Answer by username_1 on 2018-08-29. Score: 2

So what you can do is you list all of your containers with command:
docker container ls -a

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:
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 sh


---

### Answer by username_2 on 2018-08-28. Score: 0

*This answer assumes a completely broken installation, i.e. no `docker xxx` commands work (though the OP did not say that explicitely). If I guessed wrong and they do work, then please refer to username_1's answer instead.*

Docker manages all the data in `/var/lib/docker`. Look around, you should immediately be able to find it. The top level directory names are hashes, and thus look pretty garbled, but below that you have the regular file system(s) of your images and containers. All those "onionized" filesystem layers will still be there if you didn't delete them. You can search using the usual command line tools (`find` etc.), filtering by date, file size, file name, etc.


---

