How to enable the Docker Remote API on Windows
Asked Answered
B

4

8

I am trying to use the Docker Remote API on a Windows 10 host machine. I am using Chrome's Postman extension to see if I can get results from the docker remote api's endpoints. Here are the endpoints that I've tried:

GET http://192.168.99.100:4243/images/json

GET http://192.168.99.100:2376/images/json

Both returned Connection to server 192.168.99.100 failed (The server is not responding)

After a few searches I found out that the Docker Remote API is not enabled by default on Windows. Most of the guides are for Ubuntu but I have found this particular one for Windows.

These are the steps that I performed on my machine

  1. docker-machine ssh
  2. cd /var/lib/boot2docker
  3. sudo vi profile
  4. Change DOCKER_HOST='H tcp://0.0.0.2376' to DOCKER_HOST='H tcp://0.0.0.2375'
  5. change DOCKER_TLS=auto to DOCKER_TLS=no
  6. export DOCKER_HOST='-H tcp://0.0.0.2375'
  7. export DOCKER_TLS_VERIFY=0
  8. env | grep DOCKER
  9. docker-machine restart
  10. docker-machine env
  11. docker-machine regenerate-certs

After performing the steps above, I did try again the endpoints on Postman but I still get the same result.

Can you perhaps give a little help if I have missed a step? Or am I on track?

Also, to answer some of my queries.

  1. Is the docker remote api port for Windows 2375 and 4243 for Linux?
  2. Is DOCKER_HOST for Windows and DOCKER_OPTS for Linux?
Billion answered 3/11, 2016 at 9:48 Comment(1)
facing same issue ,please help usKirkwall
M
9

Switch your docker to windows container

Got to C:\ProgramData\Docker\config in deamon.json file

add "hosts": ["tcp://0.0.0.0:2376", "npipe://"]

restart docker.

give command : docker -H tcp://0.0.0.0:2376 ps

Mephitis answered 26/1, 2018 at 17:27 Comment(2)
On Windows Server 2016, replaced 2376 with 2375 and it worked!Modulate
Using Windows 11 and Docker for Windows 4.19, I have no docker directory under C:\programData. Also, what is "windows container"?Stilla
M
0

The Remote API is now enabled by default on Windows (see ticket here).

It is reachable at http:\\localhost:2375 indeed (tested it).

Moira answered 5/4, 2017 at 14:38 Comment(0)
A
0

I faced the same issue and found a quick solution for this. Just open docker settings and enable "Expose daemon on TCP..." checkbox. Docker will start automatically and the problem should be solved.Please find the image attached for reference

Anarthria answered 12/11, 2019 at 5:3 Comment(0)
S
0

using docker desktop, go to settings and check "Expose daemon on tcp://localhost:2375 without TLS"

Snoop answered 29/8, 2021 at 15:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.