Recently while setting up docker for Hyperledger in WSL2, I got the following error:
====> hyperledger/fabric-peer:2.3.2 Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
After a quick research, it turns out that if you are upgrading from WSL to WSL2, Windows leaves behind a few legacy settings from WSL that causes this issue.
Here is the fix that worked for me:
Step 1: Check if you have the same issue §
- In WSL2 terminal, run the command:
docker info | head -15
- You should see the following error:
ERROR: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
Step 2: Check if the fix works for you §
- Run the command:
- Follow the previous step again. The error should be gone now.
Step 3: Make the fix permanent §
- Edit the
- Search for the line with DOCKER_HOST and comment it out like this:
# export DOCKER_HOST=tcp://localhost:2375
- Save the file and reload the terminal settings with