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 in 2021+.

Access the MobyLinux VM’s file system:
docker container run --rm -it --privileged \
  --pid=host alpine:edge nsenter -t 1 -m -u -n -i sh

And BLAMO, you’re inside of the MobyLinux VM’s file system (aka Docker Desktop).

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.

When you’re done looking around you can hit CTRL + D or type exit to quit.

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