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 #64: Dealing with Unexplained Docker Errors

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

Sometimes you'll get weird errors from Docker or your application but you're sure things are set up right. Here's what you can do.

I can’t count the number of times where someone reported an issue on one of my Docker related courses where they mentioned that something went wrong, but then out of the blue they will message me 20 minutes later saying never mind, it’s all good, and all that changed was they restarted Docker.

It’s almost always related to Docker for Windows, Docker for Mac or Docker Machine (vbox).

Here’s my goto checklist for solving unexplainable Docker errors:
  1. docker-compose down && docker-compose up --build
  2. docker-compose down -v && docker-compose up --build
  3. Restart your Docker daemon
  4. Reboot your computer (but before doing this, always do #3 first)
  5. Upgrade to the latest stable Docker / Docker Compose release

The first one will clear out any stopped containers and re-up / build your project. The second one does the same thing but it also removes any associated volumes.

I find myself having to restart Docker for Windows about once a month to get around unexplainable errors. I don’t think Hyper-V handles things too well if you constantly push the maximum resource constraints of its VM.

Typically doing the first 3 things will solve nearly every unexplainable problem but I’ve also seen some issues require a full blown system reboot to get resolved. I’ve also witnessed cases where rebooting the system didn’t fix it, but restarting Docker did. Yay for lots of moving parts!

Upgrading to the latest stable Docker / Compose release is also a good idea, especially if you’re running a much older version of Docker. There are usually dozens of bug fixes per release.

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