Gateway not detecting web things using Docker for Windows

Hi, I’ve successfully set up the gateway however when trying to connect a virtual thing to the gateway, it is not found. I followed this tutorial to add a virtual thing: https://github.com/WebThingsIO/webthing-python. The web thing server is definitely working as I can connect to the URL and it displays the thing’s information.

I have tried adding via URL but I get an error 400. I was also getting an ECONNREFUSED error in the docker terminal however this is not showing anymore. After doing much troubleshooting, it appears it may have something to do with host networking - which I am aware is not supported in Docker for Windows. Does this mean it is not possible to setup a gateway and connect things to it using the docker image in Windows?

This is all very new to me so apologies if I have missed something obvious!

Hello @hap33 first question what is the main goal you try to achieve?

Have you taken a look at the log for more informations?

Could you copy paste it please

I use WT on an RPI and docker, with virtual things that I control remotely. As you hinted, it’s stared using host networking…

Did you try to use the IP address of the windows host rather than localhost?
Did you map port 8888 when starting the docker container?
Are there any errors in the logfile when trying to add the virtual thing?
Did you map a persistent volume to store dynamic data, addon code, logfiles so when the container restarts it won’t loose previous configurations?

The main goal I am trying to achieve is add virtual web things to the gateway (I’m essentially following this https://github.com/WebThingsIO/webthing-python).

Below are the logs I’m getting

I tried connecting via http://127.0.0.1:8888 instead of “http://localhost:8888” however no luck.

I don’t think I have mapped port 8888 when starting the docker container so that may be the issue. I simply ran the command below to create the container which is the command listed on the webthings io docker webpage (https://hub.docker.com/r/webthingsio/gateway). How can I achieve this?

docker run
-d
-p 8080:8080
-p 4443:4443
-e TZ=America/Los_Angeles
-v /path/to/shared/data:/home/node/.webthings
–log-opt max-size=1m
–log-opt max-file=10
–name webthings-gateway
webthingsio/gateway:latest

I also don’t think I have mapped a persistent volume. Again not really sure how to achieve this sorry.

Thank you for both your help, it’s really appreciated.

Why didn’t you try the virtual adapter addon then? If the goal is only to have a virtual thing

Hi @Martin_Verret, sorry I should have been more specific of my goal. I am aware of the virtual adapter addon and if I cannot solve this then that will have to be my backup. However, I already have python code for a custom thing which has lots of properties and events which would take substantial time to enter in manually via the addon GUI. Therefore obviously my preferable option is to have it working via python code so I thought I would check to see if there is a solution that way.

Try to add -p 8888:8888 in additon to.the other two

sadly it doesn’t change anything :pensive:

Where did you run your virtual thing from?

I am running this code (https://github.com/WebThingsIO/webthing-python/blob/master/example/single-thing.py) on VS Code on the same computer I am using Docker on

Ok so not on the gateway, have you test your thing url in your web browser?

Yes, it displays the following:

Please show me ipconfig result (or ifconfig of your Desktop computer is linux)

What info do you need about the ipconfig?

Try the following:

  • use local computer ip for the hardware nic of the computer
  • look in ipconfig for a NIC created to share the network between your computer and docker

One of those two ip should work, localhot won’t work because your thing id not running from your docker, but from your computer

Sorry I’m not sure what you mean. Typing in ipconfig in terminal displays lots of information and I understand each main heading is a NIC which displays info like

  • IPv4 address
  • IPv6 address
  • Subnet mask
  • Default gateway
  • etc…

Can you gave me the name of each nic and the ipv4 addreas (those are not sensitive except ig ypu have a public faced ip wich shouldn’t be

So the only two that have ipv4 addresses are: “Wireless LAN adapter WiFi” and “Ethernet adapter vEthernet (WSL)”

Try to connect with the ip of wsl:8888 from the gw

error 400 still :frowning: