docker: allow IPFS_PROFILE to choose the profile for `ipfs init`
License: MIT Signed-off-by: Antti Kaihola <antti+ipfs@kaihola.fi>
Antti Kaihola committed
Sep 15, 2018 at 21:56 UTC
df7c1fcc97ef1ecec3cefc23f7ceaaf77f9b5079
2 files changed
+9
-1
README.md
+4
@@ -317,6 +317,10 @@ Stop the running container:
317
318
docker stop ipfs_host
319
320
+When starting a container running ipfs for the first time with an empty data directory, it will call `ipfs init` to initialize configuration files and generate a new keypair. At this time, you can choose which profile to apply using the `IPFS_PROFILE` environment variable:
321
+
322
+ docker run -d --name ipfs_host -e IPFS_PROFILE=server -v $ipfs_staging:/export -v $ipfs_data:/data/ipfs -p 4001:4001 -p 127.0.0.1:8080:8080 -p 127.0.0.1:5001:5001 ipfs/go-ipfs:latest
323
+
324
### Troubleshooting
325
326
If you have previously installed IPFS before and you are running into problems getting a newer version to work, try deleting (or backing up somewhere else) your IPFS config directory (~/.ipfs by default) and rerunning `ipfs init`. This will reinitialize the config file to its defaults and clear out the local datastore of any bad entries.
bin/container_daemon
+5
-1
@@ -17,7 +17,11 @@ ipfs version
17
if [ -e "$repo/config" ]; then
18
echo "Found IPFS fs-repo at $repo"
19
else
20
- ipfs init
20
+ case $IPFS_PROFILE in
21
+ "") INIT_ARGS= ;;
22
+ *) INIT_ARGS=--profile=$IPFS_PROFILE ;;
23
+ esac
24
+ ipfs init $INIT_ARGS
25
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
26
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
27
fi