このページはルーターバージョン 0.9.50 に正確です。

DockerにI2Pをインストール

今すぐ始める

If you just want to give I2P a quick try or are using it in a home network, follow these steps:

  1. "i2pconfig"と"i2ptorrents"の2個のディレクトリを作成してください
  2. 以下のテキストをコピーして、"docker-compose.yml"ファイルにそれを保存してください。
  3. 
    version: "3.5"
    services:
        i2p:
            image: geti2p/i2p
            network_mode: host
            volumes:
                - ./i2pconfig:/i2p/.i2p
                - ./i2ptorrents:/i2psnark
    
  4. "docker-compose up"を実行してください。
  5. ブラウザを起動し、セットアップウィザードを完了するために http://127.0.0.1:7657 を開いてください。

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.

イメージをビルドする

DockerHubでI2Pのイメージが利用可能です。これを使用したくない場合は、自分でビルドできます:

docker build -t i2p .

コンテナを実行

ボリューム

コンテナには、設定データがマウントされるボリュームが必要です。任意で、トレント("i2psnark")ダウンロード用に別のボリュームをマウントすることができます。以下の例を参照してください。

メモリ使用量

By default the image limits the memory available to the Java heap to 512MB. You can override that with the JVM_XMX environment variable.

ポート

イメージが外部に晒すポートがいくつかあります。ユーザー自身のニーズに合わせて、どれを公開するか選択することができます。

ポート インターフェース 説明 TCP/UDP
4444 127.0.0.1 HTTP プロキシ TCP
4445 127.0.0.1 HTTPS プロキシ TCP
6668 127.0.0.1 IRC プロキシ TCP
7654 127.0.0.1 I2CP プロトコル TCP
7656 127.0.0.1 SAM ブリッジ TCP TCP
7657 127.0.0.1 ルーターコンソール TCP
7658 127.0.0.1 I2P サイト TCP
7659 127.0.0.1 SMTP プロキシ TCP
7660 127.0.0.1 POP3 Proxy TCP
7652 LAN interface UPnP TCP
7653 LAN interface UPnP UDP
12345 0.0.0.0 I2NP プロトコル TCP と UDP

少なくともルーターコンソール(7657)とHTTPプロキシ(4444)は必要でしょう。もしI2Pがインターネットからの接続を受信でき、ファイアーウォールに遮断されていないようにする場合は、I2NPプロトコルポート(12345)を公開します。ただし、必ず別の無作為なポートに公開してください。そうしなければ、Docker イメージでI2Pを実行していると他者が推測可能である可能性があります。

Networking

A best-practices guide for cloud deployments is beyond the scope of this document, but in general you should try to minimize the number of published ports, while exposing only the I2NP ports to the internet. That means that the services in the list above which are bound to 127.0.0.1 (which include the router console) will need to be accessed via other methods like ssh tunneling or be manually configured to bind to a different interface.

ここでは、 i2phome をホームディレクトリとしてマウントし、トレント用に i2ptorrents をマウントし、HTTP プロキシ、IRC、ルータコンソール、I2NP プロトコル を開放するコンテナの例を示します。また、JVM が利用できるメモリは 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