Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker : Unable to start ipfs-cluster by using docker #216

Closed
raucoule1u opened this issue Oct 31, 2017 · 22 comments
Closed

Docker : Unable to start ipfs-cluster by using docker #216

raucoule1u opened this issue Oct 31, 2017 · 22 comments
Assignees
Labels
exp/novice Someone with a little familiarity can pick up kind/bug A bug in existing code (including security flaws) topic/docs Documentation

Comments

@raucoule1u
Copy link

raucoule1u commented Oct 31, 2017

When i'm trying to run a docker container something goes wrong but I am not able to understand what it is.

Run the container :
docker run ipfs/ipfs-cluster

Logs :

Changing user to ipfs
ipfs version 0.4.11
initializing IPFS node at /data/ipfs
generating 2048-bit RSA keypair...done
peer identity: QmQsTifxncDb4jtKzcHA8JNo7gWzyhRQDgENLK5Nxsvno9
to get started, enter:
2017-10-31T10:01:17.122611563Z 
ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme
2017-10-31T10:01:17.122620702Z 
Initializing daemon...
ipfs-cluster-service version 0.2.1
10:01:22.139  INFO     config: Saving configuration config.go:289
ipfs-cluster-service configuration written to /data/ipfs-cluster/service.json
Unknown subcommand. Run "ipfs-cluster-service help" for more info

The container cannot start.

@raucoule1u raucoule1u changed the title Docker : unable to start ipfs-cluster by using docker Docker : Unable to start ipfs-cluster by using docker Oct 31, 2017
@hsanjuan hsanjuan self-assigned this Oct 31, 2017
@hsanjuan hsanjuan added kind/bug A bug in existing code (including security flaws) exp/novice Someone with a little familiarity can pick up status/in-progress In progress labels Oct 31, 2017
@hsanjuan hsanjuan added this to the User feedback and bugs [Q4O3] milestone Oct 31, 2017
hsanjuan added a commit that referenced this issue Oct 31, 2017
Fix #216: Docker does not like an env variable in CMD (anymore?)
@ghost ghost removed the status/in-progress In progress label Oct 31, 2017
@hsanjuan
Copy link
Collaborator

Hey @raucoule1u sorry for that, there should be a new latest image available in a few minutes which should work

@hsanjuan
Copy link
Collaborator

Also, worth mentioning #200

@raucoule1u
Copy link
Author

It works now but there is still an issue with the IPFS HTTP API on port 5001 :

12:43:24.044  INFO    cluster: IPFS Cluster is ready cluster.go:379
12:43:24.048 ERROR   ipfshttp: error getting:Post http://127.0.0.1:5001/api/v0/r
epo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused ipfshttp.go:68
9
12:43:24.048 ERROR   ipfshttp: Post http://127.0.0.1:5001/api/v0/repo/stat: dial
 tcp 127.0.0.1:5001: getsockopt: connection refused ipfshttp.go:806
12:43:24.048 ERROR  p2p-gorpc: Post http://127.0.0.1:5001/api/v0/repo/stat: dial
 tcp 127.0.0.1:5001: getsockopt: connection refused client.go:125
12:43:24.048 ERROR   diskinfo: Post http://127.0.0.1:5001/api/v0/repo/stat: dial
 tcp 127.0.0.1:5001: getsockopt: connection refused disk.go:87

@chiragbhaiji
Copy link

chiragbhaiji commented Nov 1, 2017

I am also facing the same issue with the IPFS HTTP API on port 5001 while running theipfs-culster-service through go.

9:05:20.797 ERROR   ipfshttp: error getting:Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused ipfshttp.go:689
09:05:20.797 ERROR   ipfshttp: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused ipfshttp.go:806
09:05:20.797 ERROR  p2p-gorpc: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused client.go:125
09:05:20.797 ERROR   diskinfo: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused disk.go:87

@hsanjuan
Copy link
Collaborator

hsanjuan commented Nov 1, 2017

@chirag0966 are you running ipfs ?

@hsanjuan
Copy link
Collaborator

hsanjuan commented Nov 1, 2017

@raucoule1u you mentioned you are running via docker machine? I'm not sure that changes anything. If ipfs has started correctly in the container it should be available as 127.0.0.1. Can you post the full log of the cointainer starting up?

@chiragbhaiji
Copy link

Yes @hsanjuan, ipfs was initialized before.

And the above error logs are for ipfs-culster-service.

@chiragbhaiji
Copy link

16:07:23.892  INFO    cluster: IPFS Cluster v0.2.1 listening on: cluster.go:90
16:07:23.892  INFO    cluster:         /ip4/127.0.0.1/tcp/9096/ipfs/QmZbpJsepvpu8hKGq8XFe8d8G7oMTk971FYMojeATVubuE cluster.go:92
16:07:23.892  INFO    cluster:         /ip4/192.168.10.14/tcp/9096/ipfs/QmZbpJsepvpu8hKGq8XFe8d8G7oMTk971FYMojeATVubuE cluster.go:92
16:07:23.892  INFO    cluster: new Cluster peer /ip4/192.168.10.138/tcp/9096/ipfs/QmWnoEeL2mCohAooNzfwdVgjkQ2Nhomd5bHTCikzybgm4r peer_manager.go:41
16:07:23.893  INFO  consensus: starting Consensus and waiting for a leader... consensus.go:68
16:07:23.895  INFO    restapi: REST API: /ip4/127.0.0.1/tcp/9094 restapi.go:266
16:07:23.895  INFO   ipfshttp: IPFS Proxy: /ip4/127.0.0.1/tcp/9095 -> /ip4/127.0.0.1/tcp/5001 ipfshttp.go:158
16:07:26.050  INFO  consensus: Raft Leader elected: QmWnoEeL2mCohAooNzfwdVgjkQ2Nhomd5bHTCikzybgm4r raft.go:132
16:07:26.050  INFO  consensus: Consensus state is up to date consensus.go:118
16:07:26.050  INFO    cluster: Cluster Peers (not including ourselves): cluster.go:370
16:07:26.050  INFO    cluster:     - /ip4/192.168.10.138/tcp/9096/ipfs/QmWnoEeL2mCohAooNzfwdVgjkQ2Nhomd5bHTCikzybgm4r cluster.go:376
16:07:26.050  INFO    cluster: IPFS Cluster is ready cluster.go:379
16:07:26.051 ERROR   ipfshttp: error getting:Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused ipfshttp.go:689
16:07:26.051 ERROR   ipfshttp: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused ipfshttp.go:806
16:07:26.051 ERROR  p2p-gorpc: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused client.go:125
16:07:26.051 ERROR   diskinfo: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused disk.go:87

@hsanjuan
Copy link
Collaborator

hsanjuan commented Nov 1, 2017

@chirag0966 I understand you are not using docker right? In that case, ipfs does not seem to be running. It needs to be running before you launch cluster-service.

@chiragbhaiji
Copy link

chiragbhaiji commented Nov 1, 2017

@hsanjuan Thanks a lot!!! :)
It's working fine now.

If it is possible can you update the readme as well?

@hsanjuan
Copy link
Collaborator

hsanjuan commented Nov 1, 2017

@chirag0966 will do

@hsanjuan hsanjuan added the topic/docs Documentation label Nov 1, 2017
@raucoule1u
Copy link
Author

Logs :

Changing user to ipfs
ipfs version 0.4.11
initializing IPFS node at /data/ipfs
generating 2048-bit RSA keypair...done
peer identity: QmTQRfzn6B1w21pusn6EJnty68voWSF4Z3GufiMWSTpfUV
to get started, enter:

        ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme

Initializing daemon...
ipfs-cluster-service version 0.2.1
07:25:07.158  INFO     config: Saving configuration config.go:289
ipfs-cluster-service configuration written to /data/ipfs-cluster/service.json
07:25:07.229  INFO    cluster: IPFS Cluster v0.2.1 listening on: cluster.go:90
07:25:07.230  INFO    cluster:         /ip4/127.0.0.1/tcp/9096/ipfs/QmPy7Xyx6iHg
HgHEutn8WBpXnFsE3Si5UiWS67KjmRHkQd cluster.go:92
07:25:07.230  INFO    cluster:         /ip4/172.18.0.4/tcp/9096/ipfs/QmPy7Xyx6iH
gHgHEutn8WBpXnFsE3Si5UiWS67KjmRHkQd cluster.go:92
07:25:07.230  INFO  consensus: starting Consensus and waiting for a leader... co
nsensus.go:68
07:25:07.240  INFO    restapi: REST API: /ip4/0.0.0.0/tcp/9094 restapi.go:266
07:25:07.240  INFO   ipfshttp: IPFS Proxy: /ip4/0.0.0.0/tcp/9095 -> /ip4/127.0.0
.1/tcp/5001 ipfshttp.go:158
07:25:08.904  INFO  consensus: Raft Leader elected: QmPy7Xyx6iHgHgHEutn8WBpXnFsE
3Si5UiWS67KjmRHkQd raft.go:132
07:25:08.904  INFO  consensus: Consensus state is up to date consensus.go:118
07:25:08.904  INFO    cluster: Cluster Peers (not including ourselves): cluster.
go:370
07:25:08.904  INFO    cluster:     - No other peers cluster.go:373
07:25:08.904  INFO    cluster: IPFS Cluster is ready cluster.go:379
07:25:08.905 ERROR   ipfshttp: error getting:Post http://127.0.0.1:5001/api/v0/r
epo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused ipfshttp.go:68
9
07:25:08.905 ERROR   ipfshttp: Post http://127.0.0.1:5001/api/v0/repo/stat: dial
 tcp 127.0.0.1:5001: getsockopt: connection refused ipfshttp.go:806
07:25:08.905 ERROR  p2p-gorpc: Post http://127.0.0.1:5001/api/v0/repo/stat: dial
 tcp 127.0.0.1:5001: getsockopt: connection refused client.go:125
07:25:08.905 ERROR   diskinfo: Post http://127.0.0.1:5001/api/v0/repo/stat: dial
 tcp 127.0.0.1:5001: getsockopt: connection refused disk.go:87
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/172.18.0.4/tcp/4001
Swarm listening on /p2p-circuit/ipfs/QmTQRfzn6B1w21pusn6EJnty68voWSF4Z3GufiMWSTp
fUV
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/172.18.0.4/tcp/4001
API server listening on /ip4/0.0.0.0/tcp/5001
Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080
Daemon is ready

I'm running a ipfs-cluster docker container.
I'm using a docker-machine, IP : 192.168.99.100.
I'm not running ipfs daemon on my host machine.

@raucoule1u
Copy link
Author

if i run an ipfs daemon on my host machine (127.0.0.1) I have the same issue.
So I think this request Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: getsockopt: connection refused ipfshttp.go:806 is proceeded inside the container so in this case 127.0.0.1:5001 of the container is accessible from my host machine at 192.168.99.100:5001.

As the docker image ipfs/ipfs-cluster is based on ipfs/go-ipfs, I think that the ipfs daemon is already running, so if at startup you try to run the ipfs daemon (again) the issue come from the startup of ipfs-cluster because the ipfs daemon is already running (thanks to the "inheritance" of the image).

@hsanjuan
Copy link
Collaborator

hsanjuan commented Nov 2, 2017

@raucoule1u it just seems the ipfs daemon is very slow to start. The daemon is given 3 seconds to start before cluster-service. The last line of your log Daemon is ready means that cluster has started before the daemon becomes ready. But that is no problem anyway. The error messages are not critical and should stop appearing after that.

@hsanjuan hsanjuan reopened this Nov 2, 2017
@raucoule1u
Copy link
Author

Ok good, I have no problem to call the HTTP API after the Daemon is ready.

@hsanjuan
Copy link
Collaborator

hsanjuan commented Nov 2, 2017

@raucoule1u great. I have just merged #131. You may want to pull the latest docker build. It probably fixes some issues with cluster in general.

@hsanjuan hsanjuan closed this as completed Nov 2, 2017
@hsanjuan hsanjuan mentioned this issue Nov 2, 2017
@owenauch
Copy link

I'm having the same issues and struggling to get the ipfs-cluster on docker running. I'm running these commands:

  1. docker run -d ipfs/go-ipfs
  2. Wait until the daemon is ready.
  3. docker run -d ipfs/ipfs-cluster

And I continue to get this error over and over: 18:29:38.590 ERROR ipfshttp: Post http://127.0.0.1:5001/api/v0/repo/stat: dial tcp 127.0.0.1:5001: connect: connection refused rpc_api.go:286

I'd tried setting http_listen_multiaddress to where go-ipfs said the API server was listening, but that led to raft error and cluster error in ipfs-cluster.

What is the simplest set of steps/config that I can do to get this up and running in Docker?

@hsanjuan
Copy link
Collaborator

@owenauch try --net host for both containers? (https://cluster.ipfs.io/documentation/deployment/#deployment-using-docker)

Also, please check https://cluster.ipfs.io/documentation/configuration/. http_listen_multiaddress is for the cluster API, has nothing to do with go-ipfs. If anything, you'd need to set node_multiaddress.

@teehero
Copy link

teehero commented Jul 11, 2018

@hsanjuan @owenauch any updating on owenauch's issue? I'm facing the same case.

@teehero
Copy link

teehero commented Jul 11, 2018

@hsanjuan @owenauch if I start both docker(ipfs_host and ipfs_cluster) with --net=host option, this error message disappeared. Is there any other way? as this will kind of discard the network isolation,

@vkgade
Copy link

vkgade commented Mar 6, 2020

I got the same error. So, I ran a netstat and saw the API server is listening on my private network but not localhost. So, I did a curl replacing the 127.0.0.1 with 192.168.10.x, which worked. So, after running the ipfs-cluster-service init, it generates a file service.json in .ipfs-cluster folder, inside where the API server address is given, replaced the 127.0.0.1 with the 192.168.10.x for all nodes. Now when I ran the ipfs-cluster-service daemon, it worked.

@hsanjuan
Copy link
Collaborator

hsanjuan commented Mar 6, 2020

You can pass environmental variables to your docker command to overwrite configuration values https://cluster.ipfs.io/documentation/reference/configuration/#using-environment-variables-to-overwrite-configuration-values

Docker setup is explained here: https://cluster.ipfs.io/documentation/deployment/automations/#docker . Any improvements are always welcome! -> https://github.com/ipfs/ipfs-cluster-website

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up kind/bug A bug in existing code (including security flaws) topic/docs Documentation
Projects
None yet
Development

No branches or pull requests

6 participants