3

Is it possible to have a GUI file explorer (e.g. like winscp/windows or nautilus/linux) on my host machine that can show the filesystem of a running docker container?

Primarily interested in a GUI for Linux/Ubuntu

2

Docker uses cgroups for isolation.

You should be able to browse the docker container's filesystem directly via the procfs. Specifically, if you browse /proc/<pid>/root/, where <pid> is the PID of a process within the container.

From the Moby issue tracker:

docker inspect --format {{.State.Pid}} $YOUR_CONTAINER

Should give you a PID.

Therefore, from the command line, you could cd into:

/proc/$(docker inspect --format {{.State.Pid}} $YOUR_CONTAINER)/root

You should then be able to browse to that same directory from your GUI file browser. However, you likely will not be able to use the $() construct directly, which leaves you with either:

  • Using a CLI to launch a GUI file explorer pointing to that path

or

  • Using a CLI to retrieve the PID and then browse directly there in the GUI, e.g. /proc/123/root
  • Unfortunately, I don't actually have X installed so I can't test either method. However, if, say, Nautilus refuses to browse into /proc you can always symlink a different directory to there and browse to that one. Or you can bind mount it. etc etc ... – Bob Jan 23 '18 at 7:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.