Using a Flask Server with public URL

I’m trying to set up a RPi 3 as a web server using the public URL. I’ve set up the device with Balena Wifi Connect, and I’m not sure if this is causing an issue.

My docker-compose.yml file is:

version: "2.1"

services:

    wifi-connect:
    build: ./wifi-connect-master
    network_mode: "host"
    labels:
        io.balena.features.dbus: '1'
    cap_add:
        - NET_ADMIN
    environment:
        DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"
        
Web_Server:
    build: ./Web_Server
    privileged: true
    expose:
      - "80"

I’m just getting an error saying:

We encountered an error when reaching this [balena.io](https://balena.io/) device:

UUID 3ba5b6d5dc930ca665225936bfd3c62e

`tunneling socket could not be established: 500`

One possible reason is because nothing is listening on port 80 on the device.

I’ve granted support access and my UUID is 3ba5b6d5dc930ca665225936bfd3c62e

I got the code from https://github.com/balenalabs/balena-python-hello-world/blob/master/Dockerfile.template

Hi
expose exposes ports without publishing them to the host machine - they’ll only be accessible to linked services. What you want to use is the ports command

See an example in action here - https://github.com/balenalabs/multicontainer-getting-started/blob/master/docker-compose.yml

That was it, thanks.

I had tried this before but had accidentally put the dockerfile.template for the wifi-connect in the wrong folder so I started with fresh downloads of the two services and it is all working now.

Thanks,
Gregor

Glad to know it’s working now Gregor!