How can I make erp available in LAN, deployed with docker?

Try these steps.

  1. Add following labels to erpnext-nginx service
      - "traefik.http.routers.erpnext-nginx.rule=HostRegexp(`{catchall:.*}`)"
      - "traefik.http.middlewares.erpnext-nginx.headers.customrequestheaders.Host=erpnext-nginx"
      - "traefik.http.routers.erpnext-nginx.middlewares=erpnext-nginx"
  erpnext-nginx:
    image: frappe/erpnext-nginx:${ERPNEXT_VERSION}
    restart: on-failure
    environment:
      - FRAPPE_PY=erpnext-python
      - FRAPPE_PY_PORT=8000
      - FRAPPE_SOCKETIO=frappe-socketio
      - SOCKETIO_PORT=9000
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.erpnext-nginx.rule=Host(${SITES})"
      - "${ENTRYPOINT_LABEL}"
      - "${CERT_RESOLVER_LABEL}"
      - "traefik.http.services.erpnext-nginx.loadbalancer.server.port=80"
      - "traefik.http.routers.erpnext-nginx.rule=HostRegexp(`{catchall:.*}`)"
      - "traefik.http.middlewares.erpnext-nginx.headers.customrequestheaders.Host=erpnext-nginx"
      - "traefik.http.routers.erpnext-nginx.middlewares=erpnext-nginx"
    volumes:
      - sites-vol:/var/www/html/sites:rw
      - assets-vol:/assets:rw
  1. copy env-local to .env and change mysite.localhost to erpnext-nginx
cp env-local .env

# change mysite.localhost to erpnext-nginx
sed -i -e "s/mysite.localhost/erpnext-nginx/g" .env

NOTE: recommended to use exact versions like (frappe v12.9.1 and erpnext v12.11.2) instead of edge or v12 tag

  1. add a file sites/currentsite.txt e.g. execute in container echo erpnext-nginx > currentsite.txt, refer frappe_docker/site-operations.md at main · frappe/frappe_docker · GitHub
  • This configuration sets default site for the deployment.
  • traefik labels: these tell all the incoming requests to be reverse proxied to erpnext-nginx container and also sets the Host header to erpnext-nginx.
  • erpnext-nginx container gets host header as erpnext-nginx irrespective of any site input in request and serves the site mentioned in currentsite.txt, erpnext-nginx