Learn Docker With My Newest Course

Dive into Docker takes you from "What is Docker?" to confidently applying Docker to your own projects. It's packed with best practices and examples. Start Learning Docker →

Docker Tip #70: Gain Access to the MobyLinux VM on Windows or MacOS

blog/cards/docker-tips-and-tricks.jpg

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.

I ran 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.

Free Intro to Docker Email Course

Over 5 days you'll get 1 email per day that includes video and text from the premium Dive Into Docker course. By the end of the 5 days you'll have hands on experience using Docker to serve a website.


Comments