aboutsummaryrefslogtreecommitdiff
path: root/docker/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'docker/README.md')
-rw-r--r--docker/README.md130
1 files changed, 130 insertions, 0 deletions
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 000000000..4e0e6b951
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,130 @@
1# gnunet-docker
2A Dockerfile (and maybe later docker-compose.yml) for getting a running GNUnet docker container.
3
4> This README and parts of the Dockerfile were adapted from https://github.com/compiaffe/gnunet-docker
5
6
7## Build it
8This will take quite a while and will consume a bit of data.
9
10```bash
11docker build -t gnunet .
12```
13
14## Start it from the newly created gnunet image
15Start a container from `gnunet` image, which can access /dev/net/tun, has access to the host network. We are going to name it `gnunet1`.
16
17Note the `--rm` that will delete the container as soon as you stop it and `-ti` gives you an interactive terminal.
18
19#### Linux Users
20```bash
21docker run \
22 --rm \
23 -ti \
24 --privileged \
25 --name gnunet1 \
26 --net=host \
27 -v /dev/net/tun:/dev/net/tun \
28 gnunet
29```
30
31#### Mac Users
32```bash
33docker run \
34 --rm \
35 -it \
36 --privileged \
37 --name gnunet1 \
38 -e LOCAL_PORT_RANGE='40001 40200' \
39 -e GNUNET_PORT=2086 \
40 -p 2086:2086 \
41 -p 2086:2086/udp \
42 -p40001-40200:40001-40200 \
43 -p40001-40200:40001-40200/udp \
44 gnunet
45```
46
47This terminal will keep on printing to screen at the moment. So go on in a new terminal please.
48
49Don't worry about warnings too much...
50
51## Check if you are connected
52Open a new terminal and connect to the container we just started:
53
54```bash
55docker exec -it gnunet1 gnunet-peerinfo -i
56```
57
58If you get a list of peers, all is good.
59
60## Multiple containers on the same host
61### Running
62#### Run Container 1
63```bash
64export GPORT=2086 LPORT='40001-40200' GNAME=gnunet1
65docker run \
66 --rm \
67 -it \
68 --privileged \
69 -e GNUNET_PORT=$GPORT \
70 -e LOCAL_PORT_RANGE="${LPORT/-/ }" \
71 -p $GPORT:$GPORT \
72 -p $GPORT:$GPORT/udp \
73 -p$LPORT:$LPORT \
74 -p$LPORT:$LPORT/udp \
75 --name $GNAME \
76 gnunet
77```
78
79#### Run Container 2
80```bash
81export GPORT=2087 LPORT='40201-40400' GNAME=gnunet2
82docker run \
83 --rm \
84 -it \
85 --privileged \
86 -e GNUNET_PORT=$GPORT \
87 -e LOCAL_PORT_RANGE="${LPORT/-/ }" \
88 -p $GPORT:$GPORT \
89 -p $GPORT:$GPORT/udp \
90 -p$LPORT:$LPORT \
91 -p$LPORT:$LPORT/udp \
92 --name $GNAME \
93 gnunet
94```
95
96### Testing cadet example
97#### Container 1
98```bash
99$ docker exec -it gnunet1 bash
100$ gnunet-peerinfo -s
101I am peer `VWPN1NZA6YMM866EJ5J2NY47XG692MQ6H6WASVECF0M18A9SCMZ0'.
102$ gnunet-cadet -o asdasd
103```
104
105#### Container 2
106```bash
107$ docker exec -it gnunet2 bash
108$ gnunet-cadet VWPN1NZA6YMM866EJ5J2NY47XG692MQ6H6WASVECF0M18A9SCMZ0 asdasd
109```
110
111### Testing file sharing example
112#### Container 1
113```bash
114$ docker exec -it gnunet1 bash
115$ echo 'test' > test.txt
116$ gnunet-publish test.txt
117Publishing `/test.txt' done.
118URI is `gnunet://fs/chk/1RZ7A8TAQHMF8DWAGTSZ9CSA365T60C4BC6DDS810VM78D2Q0366CRX8DGFA29EWBT9BW5Y9HYD0Z1EAKNFNJQDJ04QQSGTQ352W28R.7MYB03GYXT17Z93ZRZRVV64AH9KPWFSVDEZGVE84YHD63XZFJ36B86M48KHTZVF87SZ05HBVB44PCXE8CVWAH72VN1SKYPRK1QN2C98.5'.
119```
120
121#### Container 2
122```bash
123$ docker exec -it gnunet2 bash
124$ gnunet-download -o out.file "gnunet://fs/chk/1RZ7A8TAQHMF8DWAGTSZ9CSA365T60C4BC6DDS810VM78D2Q0366CRX8DGFA29EWBT9BW5Y9HYD0Z1EAKNFNJQDJ04QQSGTQ352W28R.7MYB03GYXT17Z93ZRZRVV64AH9KPWFSVDEZGVE84YHD63XZFJ36B86M48KHTZVF87SZ05HBVB44PCXE8CVWAH72VN1SKYPRK1QN2C98.5"
125100% [============================================================]
126Downloading `out.file' done (0 b/s).
127$ cat out.file
128test
129```
130