Docker Tip #70: Gain Access to the MobyLinux VM on Windows or MacOS
You can't just load up your hypervisor's management app and log into the VM that Docker created, but you can check it out. Here's how.
This tip applies to anyone running Docker for Windows or Docker for Mac.
Access the MobyLinux VM’s file system:
# Run this from your regular terminal on Windows / MacOS: docker container run --rm -it -v /:/host alpine # Once you're in the container that we just ran, run this: chroot /host
And BLAMO, you’re inside of the MobyLinux VM’s file system.
Now if you run
ls -la you’ll see all sorts of things, such as your mounts. In Docker Tip #69 I talked about protecting against Docker’s container logs from eating up all of your disk space. This was how I figured how much space was being used on my Windows system.
du -chs /var/lib/docker/containers/*/*json.log inside of the container we’re in now, which tallies up the total disk space used by all container logs.
By the way, you can press
CTRL +D twice to exit the container. Once to exit what
chroot /root did, which was to change the root directory to point to the MobyLinux VM instead of Alpine, and again to exit the Alpine session.