📜 ⬆️ ⬇️

Launch i2pd in the Docker container on CentOS 7

image On Habrahabr there is an excellent article on i2pd . The only drawback of the project is that its authors provide packages only for Ubuntu and Debian, which constitutes a certain inconvenience for CentOS users.


The owner of a home NAS on CentOS 7 like me is left to either collect i2pd from source, or use Docker to install it on top of the Debian Jessie image.


So, the article is devoted to creating a container with i2pd in Docker under CentOS 7.


Docker installation


Docker has its own repository with current versions. To enable it, we will create in the /etc/yum.repos.d directory the /etc/yum.repos.d file with the following contents:


 [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg 

Then install the package we need:


 $ sudo yum install docker $ sudo yum install docker-engine $ sudo systemctl enable docker.service $ sudo systemctl start docker 

Now you can check the correctness of the installation:


 $ sudo docker run --rm hello-world 

And if everything is ok, then we are left to add a user who will indulge in containers to the docker group:


 $ sudo usermod -aG docker cube 

Create an image


To do this, we need to create a Dockerfile file with the following contents:


 FROM debian:jessie MAINTAINER Cube <kyb.6.granei@yandex.ru> #     ,      #            EXPOSE 4444 4447 7070 9439 #   RUN apt-get update && apt-get upgrade #   i2pd RUN apt-get install -y wget \ libboost-date-time1.55.0 \ libboost-filesystem1.55.0 \ libboost-program-options1.55.0 \ libboost-system1.55.0 \ libminiupnpc10 #    i2pd    RUN cd /tmp && wget https://github.com/PurpleI2P/i2pd/releases/download/2.9.0/i2pd_2.9.0-1jessie1_amd64.deb RUN dpkg -i /tmp/i2pd_2.9.0-1jessie1_amd64.deb RUN rm /tmp/i2pd_2.9.0-1jessie1_amd64.deb #   i2pd  -  #   shell RUN usermod -s /bin/bash i2pd #   i2pd     #   COPY i2pd.conf /etc/i2pd/i2pd.conf COPY subscriptions.txt /etc/i2pd/subscriptions.txt #     . #       ENTRYPOINT exec su - i2pd -c "/usr/sbin/i2pd --conf ~/i2pd.conf" 

Next to the Dockerfile should be two files.



 log = stdout daemon = false service = false ## Port to listen for connections ## By default i2pd picks random port. You MUST pick a random number too, ## don't just uncomment this port = 9439 ## Enable communication through ipv4 ipv4 = true ## Enable communication through ipv6 ipv6 = true ## Bandwidth configuration ## L limit bandwidth to 32Kbs/sec, O - to 256Kbs/sec, P - to 2048Kbs/sec, ## X - unlimited ## Default is X for floodfill, L for regular node bandwidth = O ## Router will be floodfill # floodfill = true [http] ## Uncomment and set to 'false' to disable Web Console enabled = true ## Address and port service will listen on address = 0.0.0.0 port = 7070 [httpproxy] ## Uncomment and set to 'false' to disable HTTP Proxy enabled = true ## Address and port service will listen on address = 0.0.0.0 port = 4444 ## Optional keys file for proxy local destination # keys = http-proxy-keys.dat [socksproxy] ## Uncomment and set to 'false' to disable SOCKS Proxy enabled = true ## Address and port service will listen on address = 0.0.0.0 port = 4447 


 http://inr.i2p/export/alive-hosts.txt http://stats.i2p/cgi-bin/newhosts.txt http://i2p-projekt.i2p/hosts.txt http://i2host.i2p/cgi-bin/i2hostetag http://no.i2p/export/alive-hosts.txt http://rus.i2p/hosts.txt http://udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.i2p/hosts.txt 

Now run the command to create our image. Docker will automatically download and install the necessary layers:


 $ docker build -t i2pd . 

We start the container


 $ docker run --name=i2pd -td -p 7070:7070 -p 4444:4444 -p 4447:4447 -p 9439:9439 i2pd 

The -p switch indicates which ports to open to the outside, and -td starts the process in the background, while it continues to write the log to stdout, which is standard practice when using containers and allows you to conveniently view its output with the command:


 $ docker logs -t i2pd 

After launching, our i2pd console is available on port 7070 , and http- and socks-proxy on ports 4444 and 4447 respectively.


For the lazy


For those who do not want to create a container on their own, I made it ready for the Docker hub. It is installed with one command:


 $ docker pull hexaedron/i2pd 

It starts in the same way as described above.


Conclusion


I'll finish the article with a link on github - there is Dockefile itself, a couple of start-stop scripts and configs. I hope someone will find the information useful. I will be glad to constructive criticism.


')

Source: https://habr.com/ru/post/312926/


All Articles