Reach the container from another device on my local network

Hi team!
so i'm trying to access my web UI from another device all on LAN:
what i can do:

  • i can reach/display the web UI of traefik from another device at 192.168.1.50 # this is the IP of my host, not the container
  • i can curl my app1(whoami): curl -H Host:app1.192.168.1.50 http://192.168.1.50 # i receive the correct answer
    what i can't do:
  • i can't reach the web UI of app1.192.168.1.50 in my browser nothing happen

if i'm on the host (192.168.1.50) i can reach web UI from both

  • app1.localhost = display tthe web UI of whoami
  • localhost = display the web UI of traefik

the point for me it's to close all my port and let traefik manage all my port, basic stuff but i'm blocked
if some mastermind have some free time for help :slight_smile:

services:
  traefik:
    restart: unless-stopped
    container_name: traefik
    hostname: traefik
    image: traefik:v3.0
      - --api.insecure=true 
      - --api.dashboard=true
      - --api.debug=true
      - --providers.docker.exposedByDefault=false
      - "--providers.docker.defaultRule=Host(`localhost`) || (Host(`192.168.1.50`))"
      - --entrypoints.http.address=:80
      - --providers.docker=true
    ports:
      - "80:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    labels:
      - "traefik.enable=true" # active la gestion de ce container par Traefik
      - "traefik.http.routers.traefik.rule=Host(`localhost`)  || (Host(`192.168.1.50`))"
      - "traefik.http.routers.traefik.service=api@internal" 
  app1:
    image: containous/whoami
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.app1.rule=Host(`app1.localhost`)  || (Host(`app1.192.168.1.50`))"
      - "traefik.http.services.app1.loadBalancer.server.port=80"

Can you explain again what does not work?

Is that a URL you try to reach?

exactly !
i'm on the same network but from another computer, trying to reach app1.192.168.1.50 = nothing then trying to reach 192.168.1.50 display the web UI of traefik
if i'm behind the concerned computer(192.168.1.50) and go to app1.localhost in my browser , it display something

What is that supposed to mean? A regular IPv4 has x.x.x.x. You can not add a sub-domain to an IP address.

Either you use an IP and port (x.x.x.x:y) or you use a domain name (sub.example.com).

Note that some browsers will resolve something like app.localhost always to localhost IP, even if you have something different in your local hosts or DNS.

thx for your help! i was confused and thought the docker.sock could work like dns!