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