O
O
Oleg-san2017-03-03 20:10:59
virtual box
Oleg-san, 2017-03-03 20:10:59

How to properly set up Docker API in VirtualBox?

Greetings gentlemen.
Help to understand the following problem:
There is a Windows machine on which VirtualBox is installed, and a virtual machine on Centos 7 is spinning in it.
The network in the machine is configured through the "Virtual Adapter".
Docker is installed on the machine itself and one container is raised with a simple python web application that listens on port 5000 on the machine and, when a request is received, returns a simple html page.
If on a win wheelbarrow to send an http request to ip_vir_machine:5000 it will return the html page as it should.
Docker itself has the "Docker API" enabled. It is enabled using this simple config:

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock

The config itself is located along the path /etc/systemd/system/docker.service.d/remote-api.conf.
If you access api in the virtual machine itself, then it returns a response without problems (curl 0.0.0.0:2376/images/json).
But if he tries to access api http://ip_vir_machine:2376/images/json from win machine, then an error message (time out) takes off.
Can anyone tell me what the problem is and how it can be fixed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg-san, 2017-03-03
@Oleg-san

The problem was that port 2376 was closed and the firewall did not let the request through.
After opening the port, everything worked.
Commands to open a port:

firewall-cmd --add-port=2376/tcp
firewall-cmd --add-port=2376/tcp --permanent

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question