user3927415
user3927415

Reputation: 435

curl is not working inside a docker container

Im using an nginx container on my VMs as a proxy to some services.

In most of the VMs it works just fine, but I have a single VM which the nginx does not work in it. Tried to make requests with curl inside the container and it does not work, whereas, the curls do work outside the container on the VM.

Because it works on all the other VMs, I assumed it is a problem with the docker configuration on that specific VM.

The error i get from the curl inside the container is: Failed to connect to x.x.x.x port 443: no route to host

(Tried maybe to add the --add-host parameter in the docker run, but it didn't help either)

Appreciate any help :)

Upvotes: 3

Views: 1583

Answers (1)

user3927415
user3927415

Reputation: 435

Solved my problem by appending --net=host to the docker run command.

Apparently, for this specific VM, I had to explicitly define the network of the nginx container as host

(which enable the container to sends request to the outside world)

Upvotes: 2

Related Questions