GUI accessible from 127.0.0.1 instead of LAN server ip?

I tried to use docker to deploy syncthing on my home server, built my own image with an user app, then in docker-compose.yaml

syncthing:
  build:
    context: ./syncthing
  image: my-syncthing-image
  container_name: syncthing
  hostname: HomeServer
  user: app
  volumes:
    # mounting config folder
    - ${SOME_FOLDER}:/home/app/.config/syncthing
  environment:
    - STGUIADDRESS=0.0.0.0:1234
  command: syncthing
  networks:
    - default
  ports:
    - 1234:1234
    - 22000:22000/tcp
    - 22000:22000/udp

Home server IP: 192.168.1.123, My PC IP: 192.168.1.234

Then when I tried to access the web ui from 192.168.1.123:1234 it was not able to connect, but instead I was able to access it from 127.0.0.1:1234.

This seems pretty weird/confusing to me because I have a syncthing process running on my pc as well, which uses the default port 8384. And when I set the STGUIADDRESS=0.0.0.0:8384 on my home server, it somehow bumps the port and I can access the home server’s web ui from 127.0.0.1:8385… is this expected? How could I set it up so that it’s accessible via my home server ip instead?

Why don’t you just use the official docker image?

There’s also no need to change the port within the container itself as those are isolated from the host. You only have to modify the mapping in your compose file.

Thanks for replying!

yeah I understand that I don’t need to change the port when using official syncthing/syncthing image as it already defined EXPOSE map[21027/udp:{} 22000/tcp:{} 22000/udp:{} 8384/tcp:{}] and ENV STGUIADDRESS=0.0.0.0:8384 in Dockerfile, but I haven’t defined those in my image. But I guess this is not related to web ui ip?

Also I used bridge driver for network

Oh actually it works with my home server ip now…probably a temporary issue. Sorry for the confusion!