From 37100ca93d2cfc5c3f6cb5b49b4f66a321519299 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 28 Apr 2021 21:46:22 +0000 Subject: [PATCH] Docker cleanup and documentation --- Docker.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 3 ++- README.md | 2 ++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 Docker.md diff --git a/Docker.md b/Docker.md new file mode 100644 index 0000000000..d8d797c9dd --- /dev/null +++ b/Docker.md @@ -0,0 +1,49 @@ +# I2P in Docker + +### Building an image +There is an i2P image available over at [DockerHub](https://hub.docker.com). If you do not want to use that one, you can build one yourself: +``` +docker build -t i2p . +``` + +### Running a container + +#### 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. + +#### Memory usage +By the default the image limits the memory available to the Java heap to 512MB. You can override that with the `JVM_XMX` environment variable. + +#### Ports +There are several ports which are exposed by the image. You can choose which ones to publish depending on your specific needs. + +|Port|Description|TCP/UDP| +|---|---|---| +|4444|HTTP Proxy|TCP| +|4445|HTTPS Proxy|TCP| +|6668|IRC Proxy|TCP| +|7654|I2CP Protocol|TCP| +|7656|SAM Bridge TCP|TCP| +|7657|Router console|TCP| +|7658|I2P Site|TCP| +|7659|SMTP Proxy|TCP| +|7660|POP Proxy|TCP| +|12345|I2NP Protocol|TCP and UDP| + +You probably want at least the Router Console (7657) and the HTTP Proxy (4444). If you want I2P to be able to receive incoming connections from the internet, and hence not think it's firewalled, publish the I2NP Protocol port (12345) - but make sure you publish to a different random port, otherwise others may be able to guess you're running I2P in a Docker image. + +#### Example +Here is an example container that mounts `i2phome` as home directory, `i2ptorrents` for torrents, and opens HTTP Proxy, IRC, Router Console and I2NP Protocols. It also limits the memory available to the JVM to 256MB. +``` +docker run \ + -e JVM_XMX=256m \ + -v i2phome:/i2p/.i2p \ + -v i2ptorrents:/i2psnark \ + -p 4444:4444 \ + -p 6668:6668 \ + -p 7657:7657 \ + -p 54321:12345 \ + -p 54321:12345/udp \ # I2NP port needs TCP and UDP. Change the 54321 to something random, greater than 1024. + i2p:latest +``` + diff --git a/Dockerfile b/Dockerfile index d88d70c675..2361dace2e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ COPY . . RUN add-pkg --virtual build-base gettext tar bzip2 apache-ant openjdk8 \ && ant preppkg-linux-only \ + && rm -rf pkg-temp/osid pkg-temp/lib/wrapper pkg-temp/lib/wrapper.* \ && del-pkg build-base gettext tar bzip2 apache-ant openjdk8 FROM jlesage/baseimage:alpine-3.10-glibc @@ -23,7 +24,7 @@ COPY docker/rootfs/ / VOLUME ["${APP_HOME}/.i2p"] VOLUME ["/i2psnark"] -EXPOSE 7654 7656 7657 7658 4444 6668 8998 7659 7660 4445 12345 +EXPOSE 7654 7656 7657 7658 4444 6668 7659 7660 4445 12345 # Metadata. LABEL \ diff --git a/README.md b/README.md index 85741e0420..5e8e3a5dff 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ your `~/.gradle/gradle.properties`: systemProp.socksProxyHost=localhost systemProp.socksProxyPort=9150 +### Docker +For more information how to run I2P in Docker, see [Docker.md](Docker.md) ## Contact info Need help? See the IRC channel #i2p on irc.freenode.net