I need to access a file system of a docker image, but when I use the path /var/lib/docker this is what I get
buildkit/ containers/ image/ network/ overlay2/ plugins/ runtimes/ swarm/ tmp/ trust/ volumes/I can't find aufs, so how can I access the file sys of any docker images ?
2 Answers
In additon to MaestroGlanz' answer, you can also export an entire filesystem of a Docker container to a .tar archive:
user@machine $ docker export --output="container-name.tar" <container-name>And to reiterate again, if you need persistent access to some files or folders inside a container, it might be a good idea to map them directly when starting the container, like this:
user@machine $ docker run -d -v /path/to/data:/data <container-name>This will map the directory /data inside the container to the directory /path/to/data on your local filesystem.
Normally, you can't find your container's files on your hard drive. If you want to browse the files, you need a shell inside the container:
user@machine $ docker exec - it <container-name> /bin/bashIf you want to access the file, best is to copy it from the container with
user@machine $ docker cp <container-name>:/path/to/file /target/path/If you want to access the real file, you have to mount the file into the container on creation.
2