From 97217c92a50100779efedc89fa73dee819da31f5 Mon Sep 17 00:00:00 2001 From: Michael Lovci Date: Mon, 13 Apr 2015 12:03:15 -0300 Subject: [PATCH 1/3] Added documentation for docker usage. #1052 --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index db82520f0..2a998190f 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,53 @@ Basic proof of 'ipfs working' locally: ipfs cat +### Docker usage + +An ipfs docker image is hosted at [hub.docker.com/u/jbenet/go-ipfs](hub.docker.com/u/jbenet/go-ipfs). +To make files visible inside the container you need to mount a host directory +with the `-v` option to docker. Choose a directory that you want to use to +import/export files from ipfs. You should also choose a directory to store +ipfs files that will persist when you restart the container. + + export ipfs_staging= + export ipfs_data= + +Start a container running ipfs and expose ports 4001, 5001 and 8080: + + docker run -d --name ipfs_host -v $ipfs_staging:/export -v $ipfs_data:/root/.go-ipfs -p 8080:8080 -p 4001:4001 -p 5001:5001 jbenet/go-ipfs:latest + +Wait for ipfs to start. ipfs is running when you see "Gateway +(readonly) server +listening on /ip4/0.0.0.0/tcp/8080" in the container logs (`docker logs -f +ipfs_host`) + +Run ipfs commands: + + docker exec ipfs_host ipfs + +For example: connect to peers + + docker exec ipfs_host ipfs swarm peers + + +Add files: + + cp -r $ipfs_staging + docker exec ipfs_host ipfs add -r /export/ + +Stop the running container: + + docker stop ipfs_host + +#### Docker usage with VirtualBox/boot2docker (OSX and Windows) + +Since docker is running in the boot2docker VM, you need to forward +relevant ports from the VM to your host for ipfs act normally. This is +accomplished with the following command: + + boot2docker ssh -L 5001:localhost:5001 -L 4001:localhost:4001 -L 8080:localhost:8080 -fN + + ### Troubleshooting 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 From 686bf814441ceeb925dd6089ff1644f80da857f5 Mon Sep 17 00:00:00 2001 From: Michael Lovci Date: Mon, 13 Apr 2015 17:34:37 -0300 Subject: [PATCH 2/3] Changed docker hub source URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a998190f..8f028fb5c 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Basic proof of 'ipfs working' locally: ### Docker usage -An ipfs docker image is hosted at [hub.docker.com/u/jbenet/go-ipfs](hub.docker.com/u/jbenet/go-ipfs). +An ipfs docker image is hosted at [hub.docker.com/u/ipfs/go-ipfs](hub.docker.com/u/ipfs/go-ipfs). To make files visible inside the container you need to mount a host directory with the `-v` option to docker. Choose a directory that you want to use to import/export files from ipfs. You should also choose a directory to store From 94c67bf7ff385c72e8f4a84733ea4bdd9451c176 Mon Sep 17 00:00:00 2001 From: Michael Lovci Date: Mon, 13 Apr 2015 17:42:27 -0300 Subject: [PATCH 3/3] Formatting README.md for readibility --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8f028fb5c..fa33d700d 100644 --- a/README.md +++ b/README.md @@ -104,10 +104,10 @@ Start a container running ipfs and expose ports 4001, 5001 and 8080: docker run -d --name ipfs_host -v $ipfs_staging:/export -v $ipfs_data:/root/.go-ipfs -p 8080:8080 -p 4001:4001 -p 5001:5001 jbenet/go-ipfs:latest -Wait for ipfs to start. ipfs is running when you see "Gateway -(readonly) server -listening on /ip4/0.0.0.0/tcp/8080" in the container logs (`docker logs -f -ipfs_host`) +Wait for ipfs to start. ipfs is running when you see: + + Gateway (readonly) server + listening on /ip4/0.0.0.0/tcp/8080" in the container logs (`docker logs -f ipfs_host`) Run ipfs commands: