Recently, I was working on Docker, an application build and deployment tool. More specifically I was working on a Docker container setup with test containers when I ran into several issues. To help you out in the future, I would like to share some practical solutions that I found while working on Windows.
When I installed Docker on my computer and had to reboot my windows machine, Docker desktop would not automatically start.
Solution
Run Docker as Administrator, this should solve the problem.
Docker was designed as a client/server application, which allows you to have remote access to the docker API. This allowed tools like the classic container-based swarm, that were effectively a reverse proxy to a cluster of docker hosts.
The Docker daemon also provides a place for shared state. It restarts containers according to their restart policy, but it is also managing networks and volumes that may be shared between multiple containers.
Solution
I searched the internet and found out that you need to expose the daemon as shown in the picture below.
When Docker Desktop ran as administrator, and I wanted to try and run a container test from IntelliJ, an error occurred saying I was not able to make a connection or there was no valid Docker environment. This problem was solved with several hacks and tweaks, but none of them was the effective solution. A few hacks I tried:
Reinstall Docker Desktop – This did not work
Reset Docker to the factory settings – Solved the problem once but was not the best solution.
Open a command prompt as administrator and try to login to Docker and try to pull an image – The login solved the problem for one day.
Solution
After some research I found out that the port we need to start the Docker daemon was already in use by Hyper-V. Some tweaks to my Hyper-V configuration were needed to solve the problem. Here are the commands I used:
netsh interface ipv4 show excludedportrange protocol=tcp
Check if none of the ranges shown by the command above contains port 2375 otherwise this problem still exists.
Disable Hyper-V and reboot:
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
Then reserve port 2375:
netsh int ipv4 add excludedportrange protocol=tcp startport=2375 numberofports=1
Enable Hyper-V and reboot again:
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All
This solved the problem, and I was able to run every test with Docker and IntelliJ without having to troubleshoot for hours.
Don’t you want to run into all the problems mentioned above? The best thing to do is to use Linux instead of Windows.
If you encounter any problems and you would like to add problems to this blogpost, please contact me on the following e-mail: Dimitri.jambers@bignited.be.
Thanks for reading this article on Troubleshooting your Docker Containers