Added documentation for docker usage. #1052
Michael Lovci committed
Apr 13, 2015 at 12:03 UTC
97217c92a50100779efedc89fa73dee819da31f5
1 file changed
+47
README.md
+47
@@ -89,6 +89,53 @@ Basic proof of 'ipfs working' locally:
89
ipfs cat <that hash>
90
91
92
+### Docker usage
93
+
94
+An ipfs docker image is hosted at [hub.docker.com/u/jbenet/go-ipfs](hub.docker.com/u/jbenet/go-ipfs).
95
+To make files visible inside the container you need to mount a host directory
96
+with the `-v` option to docker. Choose a directory that you want to use to
97
+import/export files from ipfs. You should also choose a directory to store
98
+ipfs files that will persist when you restart the container.
99
+
100
+ export ipfs_staging=</absolute/path/to/somewhere/>
101
+ export ipfs_data=</absolute/path/to/somewhere_else/>
102
+
103
+Start a container running ipfs and expose ports 4001, 5001 and 8080:
104
+
105
+ 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
106
+
107
+Wait for ipfs to start. ipfs is running when you see "Gateway
108
+(readonly) server
109
+listening on /ip4/0.0.0.0/tcp/8080" in the container logs (`docker logs -f
110
+ipfs_host`)
111
+
112
+Run ipfs commands:
113
+
114
+ docker exec ipfs_host ipfs <args...>
115
+
116
+For example: connect to peers
117
+
118
+ docker exec ipfs_host ipfs swarm peers
119
+
120
+
121
+Add files:
122
+
123
+ cp -r <something> $ipfs_staging
124
+ docker exec ipfs_host ipfs add -r /export/<something>
125
+
126
+Stop the running container:
127
+
128
+ docker stop ipfs_host
129
+
130
+#### Docker usage with VirtualBox/boot2docker (OSX and Windows)
131
+
132
+Since docker is running in the boot2docker VM, you need to forward
133
+relevant ports from the VM to your host for ipfs act normally. This is
134
+accomplished with the following command:
135
+
136
+ boot2docker ssh -L 5001:localhost:5001 -L 4001:localhost:4001 -L 8080:localhost:8080 -fN
137
+
138
+
139
### Troubleshooting
140
If you have previously installed ipfs before and you are running into
141
problems getting a newer version to work, try deleting (or backing up somewhere