- Offizieller Beitrag
Hallo zusammen,
ich arbeite grade daran meine Wasseruhr bzw. deren Anzeige zu erfassen. Dazu gehört neben dem Hardwarepart auch ein Softwareteil. Der ESP32 stellt über http://192.168.10.221/capture_with_flashlight ein aktuelles Bild der Wasseruhr bereit, was auch funktioniert. Dann gibt es einen Dockercontainer der dieses Bild nimmt und mittels Magie die Werte extrahiert. Diese werden dann auf der Seite http://192.168.10.6:3000/wasserzaehler.html angezeigt.
Nun zu meinem Problem. In dem Docker läuft ein Pythonscript, welches folgenden Fehler schmeisst, sobald ich die Seite aufrufe
192.168.10.107 (//IP meines RECHNERS) - - [17/Apr/2020 23:05:14] "GET /wasserzaehler.html HTTP/1.1" 200 -
Process Process-3:
Traceback (most recent call last):
File "/usr/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
File "/usr/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/usr/lib/python3.7/http/client.py", line 928, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/lib/python3.7/socket.py", line 727, in create_connection
raise err
File "/usr/lib/python3.7/socket.py", line 716, in create_connection
sock.connect(sa)
OSError: [Errno 113] No route to host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/lib/LoadFileFromHTTPClass.py", line 48, in ReadURL
urllib.request.urlretrieve(url, target)
File "/usr/lib/python3.7/urllib/request.py", line 247, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.7/urllib/request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 113] No route to host>
Alles anzeigen
Gut nun könnte man denken - steht doch da, er weiss nicht wie er den Host erreichen soll. Wenn ich aber vom Container aus die Ziel IP anpinge, erreich ich sie.
root@82adb0ada882:/# ping 192.168.10.221
PING 192.168.10.221 (192.168.10.221) 56(84) bytes of data.
64 bytes from 192.168.10.221: icmp_seq=1 ttl=254 time=135 ms
64 bytes from 192.168.10.221: icmp_seq=5 ttl=254 time=143 ms
64 bytes from 192.168.10.221: icmp_seq=7 ttl=254 time=214 ms
64 bytes from 192.168.10.221: icmp_seq=8 ttl=254 time=34.1 ms
Mich lässt das vermuten, dass irgendwas dazwischen funkt. Eventuell iptables? Hier noch die IP des Containers
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.6 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:ac:11:00:06 txqueuelen 0 (Ethernet)
RX packets 312 bytes 86842 (84.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 66 bytes 5433 (5.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Alles anzeigen
sowie die aktuellen iptables Regeln
root@dockerpi:~# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain DOCKER (2 references)
target prot opt source destination
ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:9000
ACCEPT tcp -- anywhere 172.17.0.2 tcp dpt:8000
ACCEPT tcp -- anywhere 172.17.0.3 tcp dpt:9001
ACCEPT tcp -- anywhere 172.17.0.3 tcp dpt:1883
ACCEPT tcp -- anywhere 172.17.0.4 tcp dpt:http
ACCEPT tcp -- anywhere 172.17.0.6 tcp dpt:3000
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (2 references)
target prot opt source destination
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
Alles anzeigen
Jemand ne Idee?