forked from I2P_Developers/i2p.i2p
Allow passing the IP address where the router console is reachable when running a Docker container
This commit is contained in:
11
Docker.md
11
Docker.md
@ -28,6 +28,17 @@ docker build -t i2p .
|
||||
|
||||
### Running a container
|
||||
|
||||
#### Environment Variables
|
||||
|
||||
It is possible to set the IP address where the I2P router is accessible by setting
|
||||
the `IP_ADDR` environment variable in your `docker run` command or your `docker-compose`
|
||||
file. For example, if you want to make your I2P router listen on all addresses, then
|
||||
you should pass `-e IP_ADDR=0.0.0.0` to your `docker run` command.
|
||||
|
||||
It is also possible to configure the memory available to the I2P router using
|
||||
environment variables. To do this, use the: `JVM_XMX` environment variable by passing,
|
||||
for example, `-e JVM_XMX=256m`.
|
||||
|
||||
#### Volumes
|
||||
The container requires a volume for the configuration data to be mounted. Optionally, you can mount a separate volume for torrent ("i2psnark") downloads. See the example below.
|
||||
|
||||
|
@ -24,12 +24,13 @@ done
|
||||
|
||||
if [ -f /.dockerenv ]; then
|
||||
echo "[startapp] Running in container"
|
||||
export IP_ADDR=$(hostname -i)
|
||||
if echo "$IP_ADDR" | grep "172.17"; then
|
||||
if [ -z "$IP_ADDR" ]; then
|
||||
export IP_ADDR=$(hostname -i)
|
||||
echo "[startapp] Running in docker network"
|
||||
sed -i "s/127.0.0.1/${IP_ADDR}/g" ./clients.config ./i2ptunnel.config
|
||||
fi
|
||||
|
||||
echo "[startapp] setting reachable IP to container IP $IP_ADDR"
|
||||
find . -name '*.config' -exec sed -i "s/127.0.0.1/$IP_ADDR/g" {} \;
|
||||
find . -name '*.config' -exec sed -i "s/localhost/$IP_ADDR/g" {} \;
|
||||
fi
|
||||
|
||||
# Options required for reflective access in dynamic JVM languages like Groovy and Jython
|
||||
@ -38,4 +39,3 @@ JAVA17OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/su
|
||||
JAVAOPTS="-Djava.net.preferIPv4Stack=false -Djava.library.path=${I2P}:${I2P}/lib -Di2p.dir.base=${I2P} -Di2p.dir.config=${HOME}/.i2p -DloggerFilenameOverride=logs/log-router-@.txt -Xmx$JVM_XMX"
|
||||
|
||||
java -cp "${CLASSPATH}" ${JAVA_OPTS} net.i2p.router.RouterLaunch
|
||||
|
||||
|
Reference in New Issue
Block a user