Access service via hotspot

Hello! I have a multi-container setup. One “Create React App” static app in nginx and another container running a python Flask app. I am in dev mode and have a hotspot working great on an RPI 4 and I can access the internet from it when I have ethernet connected also. I do not need internet access though.

I can access the Rpi via ethernet by its hostname and can access my web app and everything can communicate.

I’ve searched through the forums but I’m not sure: how to access the service on the Rpi on port 80 I have exposed when connected to the Rpi as a hotspot?

Can you share your docker-compose file? Would like to better understand how services are architected.

If I understand correctly, you have a device that acts as a hotspot, but is not passing the 80 port to the right service. Is that right?

I believe your understanding is correct. I’m looking for connecting to the service on port 80 while connected to the device via a hotspot. Maybe I need to connect to the IP of the Pi? Or maybe DHCP needs set up? Maybe there is a hostname I can connect to access my service?

Sure thing:


version: '2'
    build: ./src/web
      - "80"
    network_mode: host
      - server
    build: ./src/server
    privileged: true
    network_mode: bridge
      - "5000:5000"

(I know I have some hardcoded URLs :wink: - Also I’m exposing 2 ports, I know that is bad practice but I can remove that once I get the hotspot working )

# build environment
FROM balenalib/%%BALENA_MACHINE_NAME%%-node as build
ENV PATH /app/node_modules/.bin:$PATH

COPY package.json ./
COPY yarn.lock ./
RUN yarn install --frozen-lockfile
RUN npm install react-scripts@3.4.1 -g --silent
COPY . ./
ENV REACT_APP_SERVER_URL http://e7a539b.local:5000/
RUN npm run build

# production environment
#FROM nginx:stable-alpine
FROM arm64v8/nginx:1.17.10-alpine
COPY --from=build /app/build /usr/share/nginx/html
#COPY default.conf /etc/nginx/conf.d/default.conf
CMD ["nginx", "-g", "daemon off;"]


# base-image for python on any machine using a template variable,
# see more about dockerfile templates here:
FROM balenalib/%%BALENA_MACHINE_NAME%%-python:3-stretch-run

# use `install_packages` if you need to install dependencies,
# for instance if you need git, just uncomment the line below.
# TODO: This adds ~120mb, all I saw we needed was gcc
RUN install_packages build-essential

# Set our working directory
WORKDIR /usr/src/app

# Copy requirements.txt first for better cache on later pushes
COPY requirements.txt requirements.txt

# pip install python deps from requirements.txt on the build server
RUN pip install -r requirements.txt

# This will copy all files in our root to the working  directory in the container
COPY ./ ./

# Enable udevd so that plugged dynamic hardware devices show up in our container.

# will run when container starts up on the device
CMD ["python","-u",""]

And just to be clear here is my barebone requirements and workflow:

This device will be offline most of the time.
Turn on (with no internet access/no ethernet) -> connect to wifi hotspot -> access web app service via ip hostname or whatever is recommended. It can be hardcoded as a bookmark or anything that is easiest.

Interacting with the web app service will of course make server calls to python to interact with GPIO.

I do not need any internet sharing or anything like that.

Maybe bluetooth is more appropriate for my use case? I’ve seen Balena tutorials for web bluetooth. I just thought WiFi may be more “straightforward”.


Is the RPi that’s acting as a hot spot handing out its own addresses? And if so, is your Python-app device getting an address on a separate subnet? Presuming that your workstation has access to the hot spot subnet (either through its own wifi or route configuration), that would allow you to reach the RPi and any of its connected devices.

So, if the RPi hot spot has an address of and it’s handing out NATted addresses like, presumably your Python-app device should get an address like and you should be able to reach the web server at If the hot spot is passing through your addresses (and handing out a range of those), then your Python-app device would be listening on its own address, like

Have I got that right?



Correct @jtonello it was handing out its own addresses.
Following your explanation I ran balena device my_device and got the IP addresses:

  • (My ethernet connected home network)
  • (The hotspot network)

When connected to the hotspot I was handed

I was then able to connect to the hotspot and navigate to (80) and :5000 and both services served up as expected!

I did need to change my environment variable in my dockerfile which seems hardcoded but works for me: ENV REACT_APP_SERVER_URL

Thanks for the help @anujdeshpande and @jtonello (marked jtonello’s post as the solution)

That’s great to hear Lane and happy we could help!