forked from I2P_Developers/i2p.i2p
Docker: automatically resolve conflicting port issues when the external port used by docker does not match the port in the routerInfo
This commit is contained in:
17
Docker.md
17
Docker.md
@ -4,7 +4,8 @@
|
|||||||
If you just want to give I2P a quick try or are using it on a home network, follow these steps:
|
If you just want to give I2P a quick try or are using it on a home network, follow these steps:
|
||||||
|
|
||||||
1. Create two directories `i2pconfig` and `i2ptorrents`
|
1. Create two directories `i2pconfig` and `i2ptorrents`
|
||||||
2. Copy the following text and save it in a file `docker-compose.yml`
|
2. Create an `.env` file containing the `EXT_PORT` environment variable.
|
||||||
|
3. Copy the following text and save it in a file `docker-compose.yml`
|
||||||
```
|
```
|
||||||
version: "3.5"
|
version: "3.5"
|
||||||
services:
|
services:
|
||||||
@ -14,14 +15,14 @@ services:
|
|||||||
- 127.0.0.1:4444:4444
|
- 127.0.0.1:4444:4444
|
||||||
- 127.0.0.1:6668:6668
|
- 127.0.0.1:6668:6668
|
||||||
- 127.0.0.1:7657:7657
|
- 127.0.0.1:7657:7657
|
||||||
- 54321:12345
|
- "$EXT_PORT":"$EXT_PORT"
|
||||||
- 54321:12345/udp
|
- "$EXT_PORT":"$EXT_PORT"/udp
|
||||||
volumes:
|
volumes:
|
||||||
- ./i2pconfig:/i2p/.i2p
|
- ./i2pconfig:/i2p/.i2p
|
||||||
- ./i2ptorrents:/i2psnark
|
- ./i2ptorrents:/i2psnark
|
||||||
```
|
```
|
||||||
3. Execute `docker-compose up`
|
4. Execute `docker-compose up`
|
||||||
4. Start a browser and go to `http://127.0.0.1:7657` to complete the setup wizard.
|
5. Start a browser and go to `http://127.0.0.1:7657` to complete the setup wizard.
|
||||||
|
|
||||||
Note that this quick-start approach is not recommended for production deployments on remote servers. Please read the rest of this document for more information.
|
Note that this quick-start approach is not recommended for production deployments on remote servers. Please read the rest of this document for more information.
|
||||||
|
|
||||||
@ -81,13 +82,13 @@ docker build -t geti2p/i2p .
|
|||||||
# I2NP port needs TCP and UDP. Change the 54321 to something random, greater than 1024.
|
# I2NP port needs TCP and UDP. Change the 54321 to something random, greater than 1024.
|
||||||
docker run \
|
docker run \
|
||||||
-e JVM_XMX=256m \
|
-e JVM_XMX=256m \
|
||||||
|
-e EXT_PORT=54321 \
|
||||||
-v i2phome:/i2p/.i2p \
|
-v i2phome:/i2p/.i2p \
|
||||||
-v i2ptorrents:/i2psnark \
|
-v i2ptorrents:/i2psnark \
|
||||||
-p 127.0.0.1:4444:4444 \
|
-p 127.0.0.1:4444:4444 \
|
||||||
-p 127.0.0.1:6668:6668 \
|
-p 127.0.0.1:6668:6668 \
|
||||||
-p 127.0.0.1:7657:7657 \
|
-p 127.0.0.1:7657:7657 \
|
||||||
-p 54321:12345 \
|
-p "$EXT_PORT":"$EXT_PORT" \
|
||||||
-p 54321:12345/udp \
|
-p "$EXT_PORT":"$EXT_PORT"/udp \
|
||||||
geti2p/i2p:latest
|
geti2p/i2p:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -8,6 +8,14 @@ if [ -z $JVM_XMX ]; then
|
|||||||
JVM_XMX=512m
|
JVM_XMX=512m
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z $EXT_PORT ]; then
|
||||||
|
echo "*** EXT_PORT is unset."
|
||||||
|
echo "*** I2P router will resolve to a \"Firewalled\" state"
|
||||||
|
echo "*** please configure EXT_PORT in your docker-compose.yaml or docker run command"
|
||||||
|
else
|
||||||
|
find . -name 'router.config' -exec sed -i "s|12345|$EXT_PORT|g" {} \;
|
||||||
|
fi
|
||||||
|
|
||||||
# Explicitly define HOME otherwise it might not have been set
|
# Explicitly define HOME otherwise it might not have been set
|
||||||
export HOME=/i2p
|
export HOME=/i2p
|
||||||
|
|
||||||
@ -31,7 +39,7 @@ if [ -f /.dockerenv ] || [ -f /run/.containerenv ]; then
|
|||||||
echo "[startapp] setting reachable IP to container IP $IP_ADDR"
|
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/127.0.0.1/$IP_ADDR/g" {} \;
|
||||||
find . -name '*.config' -exec sed -i "s/localhost/$IP_ADDR/g" {} \;
|
find . -name '*.config' -exec sed -i "s/localhost/$IP_ADDR/g" {} \;
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Options required for reflective access in dynamic JVM languages like Groovy and Jython
|
# Options required for reflective access in dynamic JVM languages like Groovy and Jython
|
||||||
|
Reference in New Issue
Block a user