Docker Tip #72: When Your Dockerized Apps Suddenly Stop Working
Docker works great most of the time, but when it comes to Docker for Windows, a few things can cause your apps to stop working.
A while back, we went over Docker Tip #64 which was dealing with unexpected Docker errors, but now let’s talk about 4 more unexpected errors that are specific to Docker for Windows.
In the first 3 cases, it comes down to your volume mounts no longer working which typically leads to errors related to files not being found.
The exact error will depend on what programming language you’re working with.
For example with Python you’ll starting getting No module named ...
errors.
1. Beware of anti-virus and firewall tools:
After you update to a new Docker for Windows version, certain anti-virus and firewall tools may reset their firewall rules. Kaspersky Total Security is known to do this, but it could happen with any tool.
This can prevent your shared drives from working, which in turn breaks your volumes.
2. Changing your Windows password:
If you ever change your Windows password, you’ll want to head over to your Docker for Windows settings, shared drives, then click “Reset Credentials” under your shared drives.
If you skip doing that step, you could find that none of your drives have permission to be shared with Docker for Windows.
3. Avoiding folders that have spaces in their name:
Docker for Windows does not like folders that have spaces in its name. For example if your Windows user name has a space then chances are volumes won’t work unless you move your code to a different directory.
This isn’t limited to your Windows user name either. It’s any folder that have spaces.
4. Using cmd instead of powershell or WSL:
When trying to run your Docker containers, you may get Cannot create container for service web: b'Drive sharing failed for an unknown reason'
. This happens
if you use cmd.exe
instead of powershell.exe
or
WSL.
All of these solutions came from people who are taking my Dive into Docker course. Special thanks goes to them for reporting these issues in!