Http request error after migration in docker

Hi,

i used node-red long time in a virtual mashine, but at the moment i merge my servers a little bit. so i merged all smarthome vms in one vm with dockers.

Node-red is also a docker now and the most run pretty good. Only one thing dont work. The http request.

I have a Flow to trigger my IR Remote for my HIFI AMP.
If "play" and "Kennwood" both are true or false, do nothing. otherwise trigger my http request:
grafik

If i trigger the HTTP Request i get this error:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /ir</pre>
</body>
</html>

Test my Request with Trigger
grafik

grafik

May i need some route or setting in a docker? I can ping all ips from docker shell.

In my old virtual mashine this flow runs without errors.

I hope you can help me.

Thanks

Can you use the docker console and do a wget to that address?

1 Like

Ah ok...
bash-5.0# wget http://10.2.0.65/ir?code=501397830
Connecting to 10.2.0.65 (10.2.0.65:80)
wget: server returned error: HTTP/1.1 404 Not Found

How i solve it?

Docker Network information:
grafik

bash-5.0# traceroute 10.2.0.65
traceroute to 10.2.0.65 (10.2.0.65), 30 hops max, 46 byte packets
1 172.50.0.1 (172.50.0.1) 0.008 ms 0.010 ms 0.002 ms
2 ESP-0806BF.c-lab.one (10.2.0.65) 39.283 ms 4.827 ms 1.641 ms

Trigger Information:

Sorry, looks like some kind of Docker networking oddity, I don't use Docker much so I can't help.

What I would say is that this would probably be a lot simpler if you used MQTT instead of direct HTTP calls.

1 Like

My ESP Remote dont understand mqtt. I tried before, but it never worked.

Are you using a pre-built firmware on the ESP (e.g Tasmota or ESPhome)? Or is it custom code?

All of the main firmware for ESP includes MQTT as far as I'm aware. Adding it to your own code is also really simple as there are excellent libraries available.

If you run the wget in a terminal not in docker does it work?

1 Like

Yes

dante@infra:~# wget http://10.2.0.65/ir?code=501397830
--2022-03-27 13:10:16-- http://10.2.0.65/ir?code=501397830
Verbindungsaufbau zu 10.2.0.65:80 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: 458 [text/html]
Wird in »ir?code=501397830« gespeichert.

ir?code=501397830 100%[===================================================================================================>] 458 --.-KB/s in 0,002s

2022-03-27 13:10:17 (294 KB/s) - »ir?code=501397830« gespeichert [458/458]

Perhaps port 80 is blocked by the container. Does the system have internet access? If so then (inside and outside the container) what does this do?
wget google.com

1 Like

Inside Docker:

bash-5.0# wget google.com
Connecting to google.com (142.250.185.238:80)
wget: server returned error: HTTP/1.1 404 Not Found

Root System:

 wget google.com
--2022-03-27 13:27:35--  http://google.com/
Auflösen des Hostnamens google.com (google.com)… 142.250.185.238, 2a00:1450:4005:800::200e
Verbindungsaufbau zu google.com (google.com)|142.250.185.238|:80 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 301 Moved Permanently
Platz: http://www.google.com/ [folgend]
--2022-03-27 13:27:36--  http://www.google.com/
Auflösen des Hostnamens www.google.com (www.google.com)… 142.250.181.196, 2a00:1450:4005:802::2004
Verbindungsaufbau zu www.google.com (www.google.com)|142.250.181.196|:80 … verbunden.
HTTP-Anforderung gesendet, auf Antwort wird gewartet … 200 OK
Länge: nicht spezifiziert [text/html]
Wird in »index.html« gespeichert.

index.html [ <=> ] 13,65K --.-KB/s in 0,007s

2022-03-27 13:27:36 (1,83 MB/s) - »index.html« gespeichert [13978]

Iptables (Node-red is the 172.50.0.4):

-P INPUT ACCEPT
-P FORWARD DROP
-P OUTPUT ACCEPT
-N DOCKER
-N DOCKER-ISOLATION-STAGE-1
-N DOCKER-ISOLATION-STAGE-2
-N DOCKER-USER
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A FORWARD -j DOCKER-USER
-A FORWARD -j DOCKER-ISOLATION-STAGE-1
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o docker0 -j DOCKER
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
-A FORWARD -i docker0 -o docker0 -j ACCEPT
-A FORWARD -o br-869a0ff08f49 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o br-869a0ff08f49 -j DOCKER
-A FORWARD -i br-869a0ff08f49 ! -o br-869a0ff08f49 -j ACCEPT
-A FORWARD -i br-869a0ff08f49 -o br-869a0ff08f49 -j ACCEPT
-A DOCKER -d 172.50.0.5/32 ! -i br-869a0ff08f49 -o br-869a0ff08f49 -p tcp -m tcp --dport 9001 -j ACCEPT
-A DOCKER -d 172.17.0.2/32 ! -i docker0 -o docker0 -p tcp -m tcp --dport 9443 -j ACCEPT
-A DOCKER -d 172.50.0.5/32 ! -i br-869a0ff08f49 -o br-869a0ff08f49 -p tcp -m tcp --dport 1883 -j ACCEPT
-A DOCKER -d 172.17.0.2/32 ! -i docker0 -o docker0 -p tcp -m tcp --dport 8000 -j ACCEPT
-A DOCKER -d 172.50.0.2/32 ! -i br-869a0ff08f49 -o br-869a0ff08f49 -p tcp -m tcp --dport 8086 -j ACCEPT
-A DOCKER -d 172.50.0.3/32 ! -i br-869a0ff08f49 -o br-869a0ff08f49 -p tcp -m tcp --dport 3000 -j ACCEPT
-A DOCKER -d 172.50.0.2/32 ! -i br-869a0ff08f49 -o br-869a0ff08f49 -p tcp -m tcp --dport 2003 -j ACCEPT
-A DOCKER -d 172.50.0.4/32 ! -i br-869a0ff08f49 -o br-869a0ff08f49 -p tcp -m tcp --dport 8091 -j ACCEPT
-A DOCKER -d 172.50.0.4/32 ! -i br-869a0ff08f49 -o br-869a0ff08f49 -p tcp -m tcp --dport 8090 -j ACCEPT
-A DOCKER -d 172.50.0.4/32 ! -i br-869a0ff08f49 -o br-869a0ff08f49 -p tcp -m tcp --dport 8080 -j ACCEPT
-A DOCKER -d 172.50.0.4/32 ! -i br-869a0ff08f49 -o br-869a0ff08f49 -p tcp -m tcp --dport 1880 -j ACCEPT
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -i br-869a0ff08f49 ! -o br-869a0ff08f49 -j DOCKER-ISOLATION-STAGE-2
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -o br-869a0ff08f49 -j DROP
-A DOCKER-ISOLATION-STAGE-2 -j RETURN
-A DOCKER-USER -j RETURN

I connect to the Docker via port 80 (Node-red Admin and Dashboard Site)
So Websocket is Port 80 Input.
May i open Port 80 for output? I think outside ports run anytime, like a normal PC client.

I added Port 80, but the problem persists.

Sorry, this is beyond my knowledge base. I try to avoid Docker whenever possible, it seems to cause more problems than it solves.

I would concur with @TotallyInformation's suggestion to use MQTT, but of course it may suffer from exactly the same issue.

I presume you have tried rebooting?

I dont know how, but it works how. I didnt change anything. Weird. :face_with_raised_eyebrow:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.