Open J0hn3ch opened 6 months ago
I have little knowledge of what those WSL containers do, but can you confirm that the loopback address is even supposed to work across container boundaries?
You can test that easily by running sudo apt install socat
on the Linux side, then running sudo socat - tcp-listen:80
, and then pointing your web browser at http://127.0.0.1/
-- if forwarding works, you'll see the HTTP request in the Linux machine (and get an error in the browser); if not, socat will report nothing (and you'll get a different error).
Yes,
I enter inside the container of CoAP Server with this command: docker exec -it -u root ubuntu-coap-server bash
Next, as you write, I have installed inside the container, the tool socat with:
apt install socat
and running socat - tcp-listen:80
.
From WSL in the Docker Host (so my machine) I run a curl http://127.0.0.1
and this is the result:
CoAP-Server-Container# socat - tcp-listen:80 | Docker-Host-WSL$ curl -X GET http://127.0.0.1/
GET / HTTP/1.1 | curl: (52) Empty reply from server
Host: 127.0.0.1
User-Agent: curl/7.81.0
Accept: */*
Hi everyone,
I'm trying to build a CoAP server project, using aiocoap and Docker containers.
I'm using the Docker Compose file to manage containers in the project and a Dockerfile to build the images for the container. In this case I use a Docker image of Ubuntu to build the custom image with CoAP Server (installing python, requirements and running server.py from the aiocoap tutorial).
compose.yml & Dockerfile
Testing the server with aiocoap-client
The problem: Request outside the container, with WSL Ubuntu
In my case, I need to interact outside the container, because all the compose file will be executed in a Raspberry, so I need to send coap request from a Client (e.g. ESP32) to a CoAP Server (Raspberry Pi).
How can I solve this issue?
Working example: Request inside the container After open the bash of the container with the command
docker exec -it ubuntu-coap-server bash
aiocoap.cli.defaults: output