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 #66: Fixing Error Response from Daemon: Invalid Mode

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

This error could happen for a few reasons, but here's one fix to it that can be done by renaming a folder in your volume's path.

Over the years I’ve answered so many Docker questions from people who have taken one of my Docker courses but today I got a new question that I haven’t seen yet.

It was related to Docker volumes not working. Docker was throwing docker: Error response from daemon: invalid mode: /app. In the course we happen to use WORKDIR /app in our Dockerfile which acts as the source code location for our app.

He happened to be running MacOS and was using Docker Toolbox because he was using hardware that was not supported by Docker for Mac, but this problem could have happened with Docker for Mac too.

It could also technically happen with Linux, but not Windows if you use PowerShell because Windows won’t allow this character to be in a folder name.

Long story short, he had a : in one of his folder names that was being volume mounted into the container. After we narrowed that down and renamed the folder, everything immediately worked.

I wanted to see if I could reproduce the problem on Linux so I set up a hello:world directory and yep, it failed. Except I got a different error which was Error response from daemon: Mount denied:. I happened to use Docker CE 18.06 while he was using 18.03.

I’m not sure if the error message is different because of the Docker version or the OS. In either case, renaming the folder on Linux to strip out the colon worked.

If you want to read a longer version of this tip where I go over the process of how I came to this conclusion, you can read this article.

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