2 A Dockerfile (and maybe later docker-compose.yml) for getting a running GNUnet docker container.
4 > This README and parts of the Dockerfile were adapted from https://github.com/compiaffe/gnunet-docker
8 This will take quite a while and will consume a bit of data.
10 First you need to go to the root of this repo.
16 Now you can build the image.
19 docker build -t gnunet .
22 ## Start it from the newly created gnunet image
23 Start a container from `gnunet` image, which can access /dev/net/tun, has access to the host network. We are going to name it `gnunet1`.
25 Note the `--rm` that will delete the container as soon as you stop it and `-ti` gives you an interactive terminal.
35 -v /dev/net/tun:/dev/net/tun \
46 -e LOCAL_PORT_RANGE='40001 40200' \
50 -p40001-40200:40001-40200 \
51 -p40001-40200:40001-40200/udp \
55 This terminal will keep on printing to screen at the moment. So go on in a new terminal please.
57 Don't worry about warnings too much...
59 ## Check if you are connected
60 Open a new terminal and connect to the container we just started:
63 docker exec -it gnunet1 gnunet-peerinfo -i
66 If you get a list of peers, all is good.
68 ## Multiple containers on the same host
72 export GPORT=2086 LPORT='40001-40200' GNAME=gnunet1
77 -e GNUNET_PORT=$GPORT \
78 -e LOCAL_PORT_RANGE="${LPORT/-/ }" \
80 -p $GPORT:$GPORT/udp \
89 export GPORT=2087 LPORT='40201-40400' GNAME=gnunet2
94 -e GNUNET_PORT=$GPORT \
95 -e LOCAL_PORT_RANGE="${LPORT/-/ }" \
97 -p $GPORT:$GPORT/udp \
104 ### Testing cadet example
107 $ docker exec -it gnunet1 bash
109 I am peer `VWPN1NZA6YMM866EJ5J2NY47XG692MQ6H6WASVECF0M18A9SCMZ0'.
110 $ gnunet-cadet -o asdasd
115 $ docker exec -it gnunet2 bash
116 $ gnunet-cadet VWPN1NZA6YMM866EJ5J2NY47XG692MQ6H6WASVECF0M18A9SCMZ0 asdasd
119 ### Testing file sharing example
122 $ docker exec -it gnunet1 bash
123 $ echo 'test' > test.txt
124 $ gnunet-publish test.txt
125 Publishing `/test.txt' done.
126 URI is `gnunet://fs/chk/1RZ7A8TAQHMF8DWAGTSZ9CSA365T60C4BC6DDS810VM78D2Q0366CRX8DGFA29EWBT9BW5Y9HYD0Z1EAKNFNJQDJ04QQSGTQ352W28R.7MYB03GYXT17Z93ZRZRVV64AH9KPWFSVDEZGVE84YHD63XZFJ36B86M48KHTZVF87SZ05HBVB44PCXE8CVWAH72VN1SKYPRK1QN2C98.5'.
131 $ docker exec -it gnunet2 bash
132 $ gnunet-download -o out.file "gnunet://fs/chk/1RZ7A8TAQHMF8DWAGTSZ9CSA365T60C4BC6DDS810VM78D2Q0366CRX8DGFA29EWBT9BW5Y9HYD0Z1EAKNFNJQDJ04QQSGTQ352W28R.7MYB03GYXT17Z93ZRZRVV64AH9KPWFSVDEZGVE84YHD63XZFJ36B86M48KHTZVF87SZ05HBVB44PCXE8CVWAH72VN1SKYPRK1QN2C98.5"
133 100% [============================================================]
134 Downloading `out.file' done (0 b/s).