diff options
author | Phil <phil.buschmann@tum.de> | 2018-08-09 10:23:29 +0200 |
---|---|---|
committer | Phil <phil.buschmann@tum.de> | 2018-08-09 10:23:29 +0200 |
commit | e083dd6ae0b96f30328d0d54bc7a55f6cd34b2b4 (patch) | |
tree | 8c993110fb5958c30f41f40794bd75941a42aca0 /docker/README.md | |
parent | cffad0ad30400dda7c7c4ef77ed7625013193dbe (diff) | |
parent | b3932f39b028d5db0d2e641e8593679c657b6bd1 (diff) | |
download | gnunet-e083dd6ae0b96f30328d0d54bc7a55f6cd34b2b4.tar.gz gnunet-e083dd6ae0b96f30328d0d54bc7a55f6cd34b2b4.zip |
-Merge branch 'master' into gsoc2018/rest_api
Diffstat (limited to 'docker/README.md')
-rw-r--r-- | docker/README.md | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..ce05012fc --- /dev/null +++ b/docker/README.md | |||
@@ -0,0 +1,138 @@ | |||
1 | # gnunet-docker | ||
2 | A 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 | ||
8 | This will take quite a while and will consume a bit of data. | ||
9 | |||
10 | First you need to go to the root of this repo. | ||
11 | |||
12 | ```bash | ||
13 | cd .. | ||
14 | ``` | ||
15 | |||
16 | Now you can build the image. | ||
17 | |||
18 | ```bash | ||
19 | docker build -t gnunet . | ||
20 | ``` | ||
21 | |||
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`. | ||
24 | |||
25 | Note 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 | ||
29 | docker 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 | ||
41 | docker 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 | |||
55 | This terminal will keep on printing to screen at the moment. So go on in a new terminal please. | ||
56 | |||
57 | Don't worry about warnings too much... | ||
58 | |||
59 | ## Check if you are connected | ||
60 | Open a new terminal and connect to the container we just started: | ||
61 | |||
62 | ```bash | ||
63 | docker exec -it gnunet1 gnunet-peerinfo -i | ||
64 | ``` | ||
65 | |||
66 | If 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 | ||
72 | export GPORT=2086 LPORT='40001-40200' GNAME=gnunet1 | ||
73 | docker 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 | ||
89 | export GPORT=2087 LPORT='40201-40400' GNAME=gnunet2 | ||
90 | docker 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 | ||
109 | I 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 | ||
125 | Publishing `/test.txt' done. | ||
126 | URI 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" | ||
133 | 100% [============================================================] | ||
134 | Downloading `out.file' done (0 b/s). | ||
135 | $ cat out.file | ||
136 | test | ||
137 | ``` | ||
138 | |||