如何在Windows上启用Docker远程API [英] How to enable the Docker Remote API on Windows

查看:839
本文介绍了如何在Windows上启用Docker远程API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows 10主机上使用Docker远程API.我正在使用Chrome的Postman扩展程序,以查看是否可以从docker远程api的端点获取结果.这是我尝试过的端点:

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

两个都返回了Connection to server 192.168.99.100 failed (The server is not responding)

经过几次搜索,我发现Windows上默认未启用Docker远程API.大多数指南都是针对Ubuntu的,但是我发现了这个特殊的

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配置文件
  4. DOCKER_HOST='H tcp://0.0.0.2376'更改为DOCKER_HOST='H tcp://0.0.0.2375'
  5. DOCKER_TLS=auto更改为DOCKER_TLS=no
  6. export DOCKER_HOST ='-H tcp://0.0.0.2375'
  7. 导出DOCKER_TLS_VERIFY = 0
  8. env | grep DOCKER
  9. docker-machine restart
  10. docker-machine env
  11. docker-machine regenerate-certs
  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

执行上述步骤后,我确实在Postman上再次尝试了端点,但仍然得到相同的结果.

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. 是Windows 2375和Linux 2243的docker远程api端口吗?
  2. 对于Windows是DOCKER_HOST,对于Linux是DOCKER_OPTS?

推荐答案

将您的docker切换到windows container

Switch your docker to windows container

转到C:\ProgramData\Docker\configdeamon.json文件

添加"hosts": ["tcp://0.0.0.0:2376", "npipe://"]

重新启动docker.

restart docker.

给出命令:docker -H tcp://0.0.0.0:2376 ps

这篇关于如何在Windows上启用Docker远程API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆