How to enable access to the Docker API from Windows using the Docker Toolbox (docker machine)

I am using the latest version of the Docker Toolbox, using the latest version of Oracle VirtualBox, with Windows 7 as the host OS.

I am trying to enable non-TLS access to the remote Docker API so that I can use the Postman REST client running on Windows and connect to the Docker API running on the Docker machine in VirtualBox. I found that if the Docker configuration included -H tcp://0.0.0.0:2375, it would -H tcp://0.0.0.0:2375expose the API on port 2375 of the docking machine, but I can’t find where this configuration is stored and can be changed.

I made docker-machine sshon docker-machine sshfrom the CLI Toolbox, and then went and delved into the file /etc/init.d/docker, but no changes to the file remained after docker-machine restart.

I was able to find the answer to this question for Ubuntu and OSX, but not for Windows.

+6
source share
1 answer

@CarlosRafaelRamirez mentioned the right place, but I will add a few details and give more detailed step-by-step instructions, since Windows developers often do not own the Linux ecosystem.

Disclaimer : The following steps allow you to use the Docker Remote API from a Windows host, but keep two things in mind:

  1. This should not be done in production, as this makes the Docker very unsafe.
  2. docker-machine docker CLI. docker-machine ssh , SSH - docker.

, Docker API -TLS. (, " ". , .)

  1. "Docker Quickstart Terminal". Bash , . docker-machine ip IP- - .
  2. docker-machine ssh
  3. cd/var/lib/boot2docker
  4. sudo vi profile "vi" , "profile", Docker. ( , Windows, vi, . vi, vi . "i", . . , , Esc ZZ vi. vi , Esc :q! Enter. ":" vi mode "q!" . vi .)
  5. vi, DOCKER_HOST DOCKER_HOST='-H tcp://0.0.0.0:2375' DOCKER_TLS=no. , .
  6. exit SSH.
  7. docker-machine restart

doocker- URL- API- , , http://dokerMachineIp:2375/containers/json?all=1, JSON.

, .

, docker-machine config docker images, , , CLI docker Docker /TLS, . , , , , export DOCKER_HOST=tcp://192.168.99.101:2375 export DOCKER_TLS_VERIFY=0,

$ env | grep DOCKER
DOCKER_HOST=tcp://192.168.99.101:2375
DOCKER_MACHINE_NAME=default
DOCKER_TLS_VERIFY=0
DOCKER_TOOLBOX_INSTALL_PATH=C:\Program Files\Docker Toolbox
DOCKER_CERT_PATH=C:\Users\USERNAME\.docker\machine\machines\default

:

$ docker-machine env

TLS: / : "192.168.99.101:2376"

, , , Docker Docker, .

, docker-machine ssh docker.

+7

Source: https://habr.com/ru/post/1659123/


All Articles