How to enable docker remote API in Docker for Windows

0 votes
I have docker for windows installed on my Windows10 machine. I want to access docker using the remote API through port 8080. I guess this port is not enabled by default. Do you have any idea how to open it?
Oct 15, 2018 in Docker by Sophie may
• 10,610 points
7,663 views

3 answers to this question.

0 votes

You can edit the configuration for docker daemon. Add a daemon.json file in the following path: %ProgramData%\docker\config

The file should contain something like this:

{ "hosts": ["tcp://0.0.0.0:8080"]
}

Then restart docker service.

answered Oct 15, 2018 by Tyrion anex
• 8,700 points
0 votes
Reviving a dead thread here, but the internet is lousy with this answer. This does not work on Windows 10 hosts. Neither does editing the hosts: value in any way that I've figured out, anywhere. Even in the \Docker\Docker\resources\windows-daemon-options.service file. Some suggestions, like this one, result in Docker failing to start altogether. Others (the .service edit) just result in no bueno.

The solution is to use netsh to portproxy (forward) the TCP port back to 127.0.0.1. Here is an example. Change YOUR_IP_HERE to be your LAN ip address. You can find your LAN ip address by running "ipconfig."

All of this is done from the Windows command prompt, elevated to admin. So, completely:

First, Click Start and type CMD.

Then, right click on Command Prompt and chose to Run As Administrator. Click Yes on the elevation request, and enter any required password.

Then, if needed, type ipconfig to find your LAN ip address. If you are confused at this point, then you're probably over your skis with Docker, anyway.... You are not done spelunking through google yet, my friend. See you in a half hour or so...

If you are this far, type this. replace "YOUR_LAN_IP" with your actual LAN IP:

netsh interface portproxy add v4tov4 listenport=2375 listenaddress=YOUR_LAN_IP connectport=2375 connectaddress=127.0.0.1

You of course need to make sure Windows Firewall is open on port 2375. Ta-da. Completely insecure but you've got it.
answered May 12, 2020 by fHF

edited May 12, 2020
Thanks. Your solution was the perfect one.
0 votes

Try these steps-

  1. Navigate to /lib/systemd/system in your terminal and open docker.service file. vi /lib/systemd/system/docker.service.
  2. Save the Modified File.
  3. Reload the docker daemon. systemctl daemon-reload.
  4. Restart the container. sudo service docker restart.
  5. To test remotely, use the PC name or IP address of Docker Host.
Hope this will help
answered Aug 25, 2020 by Pistle
• 300 points

Related Questions In Docker

0 votes
1 answer

How to enable/ disable Hyper-V for Docker on Windows?

You can do this from command prompt ...READ MORE

answered Sep 10, 2018 in Docker by Tyrion anex
• 8,700 points
6,142 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+2 votes
1 answer
0 votes
2 answers
0 votes
1 answer

How to install telnet in Docker for Windows 10?

If you are trying to telnet in ...READ MORE

answered Aug 28, 2018 in Docker by Tyrion anex
• 8,700 points
3,151 views
0 votes
1 answer

How to save a Dynamic port in Docker for Windows?

The mapped ports can be accessed via ...READ MORE

answered Sep 4, 2018 in Docker by Tyrion anex
• 8,700 points
605 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP