Skip to content

Container doesnt bind properly #159

Description

@OctoNezd

Hi. Trying to use the container.

Here is my compose file:

services:
  i2p:
    image: geti2p/i2p:latest
    restart: unless-stopped
    environment:
      - IP_ADDR=0.0.0.0
      - EXT_PORT=edited
    volumes:
      - ./i2pconfig:/i2p/.i2p
    ports:
      - "7657:7657"   # Router Console
      - "4444:4444"   # HTTP Proxy
      - "edited:edited"

I cant access the console from both my host and other devices on same LAN. I get connection reset on host itself and couldnt connect to server from my laptop. When I exec into container, and install curl+net-tools, I can curl the 127.0.0.1:7657 fine. Netstat -tulpn shows that java process listens on localhost only:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.11:37499        0.0.0.0:*               LISTEN      -
tcp6       0      0 172.30.0.2:7652         :::*                    LISTEN      16/java
tcp6       0      0 127.0.0.1:7654          :::*                    LISTEN      16/java
tcp6       0      0 127.0.0.1:7657          :::*                    LISTEN      16/java
tcp6       0      0 :::edited                 :::*                    LISTEN      16/java
udp        0      0 127.0.0.11:49933        0.0.0.0:*                           -
udp6       0      0 :::1900                 :::*                                16/java
udp6       0      0 :::edited                 :::*                                16/java
udp6       0      0 172.30.0.2:7653         :::*                                16/java

I tried removing config directories with no success.

I also see that in config the non-commented binds go only to localhost, everything 0.0.0.0 is under comments:

root@13b6b263a1ae:/i2p# cat clients.config
# NOTE: This I2P config file must use UTF-8 encoding
#
# If you have a 'split' directory installation, with configuration
# files in ~/.i2p (Linux), %LOCALAPPDATA%\I2P (Windows),
# or /Users/(user)/Library/Application Support/i2p (Mac), be sure to
# edit the file in the configuration directory, NOT the install directory.
# When running as a Linux daemon, the configuration directory is /var/lib/i2p
# and the install directory is /usr/share/i2p .
# When running as a Windows service, the configuration directory is \ProgramData\i2p
# and the install directory is \Program Files\i2p .
#
# On first run, this file will be split into individual config files
# in clients.config.d/ in the configuration directory.
# Look in that directory for the file to edit.
#

# fire up the web console
## There are several choices, here are some examples:
## non-SSL, bind to local IPv4 only
#clientApp.0.args=7657 0.0.0.0 ./webapps/
## non-SSL, bind to local IPv6 only
#clientApp.0.args=7657 ::1 ./webapps/
## non-SSL, bind to all IPv4 addresses
#clientApp.0.args=7657 0.0.0.0 ./webapps/
## non-SSL, bind to all IPv6 addresses
#clientApp.0.args=7657 :: ./webapps/
## For SSL only, change clientApp.4.args below to https://
## SSL only
#clientApp.0.args=-s 7657 ::1,0.0.0.0 ./webapps/
## non-SSL and SSL
#clientApp.0.args=7657 ::1,0.0.0.0 -s 7667 ::1,0.0.0.0 ./webapps/
## non-SSL only, both IPv6 and IPv4 local interfaces
clientApp.0.args=7657 localhost ./webapps/
clientApp.0.main=net.i2p.router.web.RouterConsoleRunner
clientApp.0.name=webConsole
clientApp.0.onBoot=true

# start up the SAM bridge so other client apps can connect
clientApp.1.main=net.i2p.sam.SAMBridge
clientApp.1.name=SAMBridge
clientApp.1.args=sam.keys localhost 7656 i2cp.tcp.host=localhost i2cp.tcp.port=7654
clientApp.1.startOnLoad=false

# poke the i2ptunnels defined in i2ptunnel.config
clientApp.2.main=net.i2p.i2ptunnel.TunnelControllerGroup
clientApp.2.name=Tunnels
clientApp.2.args=i2ptunnel.config

# run our own eepsite with a seperate jetty instance
clientApp.3.main=net.i2p.jetty.JettyStart
clientApp.3.name=I2P webserver (eepsite)
## To use the rewrite handler, edit jetty-rewrite.xml and use:
#clientApp.3.args="/path/to/jetty.xml" "/path/to/jetty-rewrite.xml"
## To use local SSL, edit jetty-ssl.xml and use:
#clientApp.3.args="/path/to/jetty.xml" "/path/to/jetty-ssl.xml"
## To use local or remote JMX, edit jetty-jmx.xml and use:
#clientApp.3.args="/path/to/jetty.xml" "/path/to/jetty-jmx.xml"
clientApp.3.args="eepsite/jetty.xml"
clientApp.3.delay=30
clientApp.3.startOnLoad=false

# load a browser pointing at the web console whenever we start up
clientApp.4.main=net.i2p.apps.systray.UrlLauncher
clientApp.4.name=consoleBrowser
clientApp.4.args=http://localhost:7657/
clientApp.4.delay=5
clientApp.4.startOnLoad=false

I suspect this might been introduced in 9960bac, considering it is the commit which removed sed localhost part. Adding find . -name 'clients.config' -exec sed -i "s/localhost/$IP_ADDR/g" {} \; doesnt help. Changing both of these to search for *.config seems to be working, but it works only if I set network mode to host and DO NOT set the EXTERNAL_IP which results in the ip fields being empty.

OS: AlmaLinux 10.2, 6.12.0-211.30.1.el10_2.x86_64, SELinux disabled
Docker community 29.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions