Browse Source

added env var $IPFS_BOOTSTRAP_ADD to add bootstrap nodes

Fabian Peter Hammerle 5 years ago
parent
commit
5c4f14b91d
3 changed files with 28 additions and 6 deletions
  1. 1 0
      Dockerfile
  2. 22 5
      README.md
  3. 5 1
      entrypoint.sh

+ 1 - 0
Dockerfile

@@ -24,6 +24,7 @@ RUN wget -O- https://dist.ipfs.io/go-ipfs/v${IPFS_VERSION}/go-ipfs_v${IPFS_VERSI
     && rm -r /tmp/go-ipfs
 
 ENV IPFS_INIT_PROFILE server
+ENV IPFS_BOOTSTRAP_ADD ""
 COPY entrypoint.sh /
 RUN chmod a=rx /entrypoint.sh
 ENTRYPOINT ["/entrypoint.sh"]

+ 22 - 5
README.md

@@ -2,14 +2,31 @@
 
 docker hub: https://hub.docker.com/r/fphammerle/ipfs/
 
+## example: short
+
+```sh
+docker run --name ipfs fphammerle/ipfs
+```
+
+## example: restart automatically
+
 ```sh
-sudo docker run --detach \
+docker run --name ipfs \
     --cap-drop=all --security-opt=no-new-privileges \
-    --restart=unless-stopped \
-    --name ipfs \
-    fphammerle/ipfs:0.4.17-amd64
+    --detach --restart=unless-stopped \
+    fphammerle/ipfs:latest
 ```
 
+## example: add bootstrap peers
+
+```sh
+docker run --name ipfs \
+    --env IPFS_BOOTSTRAP_ADD='/dnsaddr/ipfs1.net/tcp/4001/QmPeerId /dnsaddr/ipfs2.net/tcp/4001/QmPeerId' \
+    fphammerle/ipfs:latest
+```
+
+## publish clipboard
+
 ```sh
-xsel -b | sudo docker exec -i ipfs ipfs-add
+xsel -b | sudo docker exec -i ipfs ipfs add -
 ```

+ 5 - 1
entrypoint.sh

@@ -4,4 +4,8 @@ if [ ! -e "$IPFS_PATH/config" ]; then
     (set -x; ipfs init --profile $IPFS_INIT_PROFILE)
 fi
 
-exec "$@"
+if [ ! -z "$IPFS_BOOTSTRAP_ADD" ]; then
+    (set -x; ipfs bootstrap add -- $IPFS_BOOTSTRAP_ADD)
+fi
+
+(set -x; exec "$@")