basforge

Search titles, text and the “If it doesn’t work” cases.

    RU

    A host-only port goes on 127.0.0.1

    Publish a port that only the server itself needs on 127.0.0.1. - 8080:8080 opens it on every address, and the host firewall’s input hook doesn’t close it.

    How to publish it

    ports:
      - "127.0.0.1:8080:8080"     # CrowdSec LAPI, Pulse, a local admin panel

    Without an address, Docker listens on every interface, and packets to the container go through the forward chain, past the input rules: ufw deny 8080 doesn’t close such a port. The details, with the packet’s path, are in Docker ports bypass the input chain.

    How to check

    docker ps --format '{{.Names}}\t{{.Ports}}'
    # crowdsec   127.0.0.1:8080->8080/tcp      — host only
    # app        0.0.0.0:8080->8080/tcp        — open on every address