1

Working behind a proxy correctly configured for a macOS Mojave (version 10.14.5), using the IBM Blockchain Platform Extension for VS Code to run containers for the Hyperledger Fabric, I got the error:

[INFO]Error response from daemon: Container 1928fd... is not running
[ERROR] Failed to start local_fabric: Error: Failed to execute command "/bin/sh" with  arguments "start.sh" return code 1

This error appears if Docker's configuration is Swarm: inactive or Swarm: active, under the following configuration:

node: v10.16.0 or v8.16.0
npm: 6.9.0 
docker: Docker version 18.09.2, build 6247962
docker-compose: docker-compose version 1.23.2, build 1110ad01

Does anybody found and solved this problem?.

david_k
  • 5,843
  • 2
  • 9
  • 16
cgironda
  • 21
  • 5
  • If you do `docker ps -a` are the containers still there but in exit status ? Can you get the logs of these containers using `docker logs – david_k Jul 26 '19 at 06:35
  • Thanks for the reply. After using `docker ps -a`, I found an "Exit(2)" for the container: `7fa9r4c897d32 hyperledger/fabric-peer:1.4.1 "peer node start" 2 minutes ago Exited (2) 2 minutes ago fabricvscodelocalfabric_peer0.org1.example.com`. For the linux VM used by docker, I allocated about 80GB. On the other hand, using `docker logs 7fa9r4c897d32`, I found: `panic: Error initializing ledger provider: unable to connect to CouchDB, check the hostname and port: error unmarshalling json data: invalid character '<' looking for beginning of value` – cgironda Jul 29 '19 at 04:53
  • I wonder if for some reason docker is trying to connect to couchdb via your proxy and the proxy is returning an html response probably saying it can't be found. So this could be a proxy/docker config issue. You might have to tell docker not to use the proxy for certain hosts. Some docs about it I found are https://docs.docker.com/network/proxy/. So you could try excluding `couchdb`, `logspout` and `*.example.com` to see if that helps (*.example.com would cover the peer, orderer and ca) – david_k Jul 29 '19 at 14:37
  • It seems that Docker for Mac proxies settings are broken, because I could not tell Docker not to use the proxy for the `couchdb`, `logspout`, and `*.example.com` hosts in the _Bypass proxy setting for these hosts & domains_ section. However, I could exclude them editing the `noProxy` directive (`"noProxy": "couchdb, logspout, *.example.com"`) in the home directory **~/.docker/config.json** file found in the https://docs.docker.com/network/proxy link that you provide me @david_k. So, in VSCode I used **Start the Fabric Runtime** in LOCAL FABRIC OPS and everything worked very well. Thank you. – cgironda Jul 30 '19 at 15:14
  • hi @cgironda I've added an official answer based on your experience (I don't use docker on a mac) as I think this is useful information for other users who may come across problems when a proxy is defined. Many thanks for the useful update. – david_k Jul 31 '19 at 17:54

2 Answers2

1

It seems that Docker for Mac proxy settings via the GUI don't work as expected and you cannot exclude certain host names using it. You can exclude hostnames by specifying the noProxy directive as follows

"noProxy": "couchdb, logspout, *.example.com" 

in the file ~/.docker/config.json as described in https://docs.docker.com/network/proxy

The names couchdb, logspout and *.example.com (which covers the ca, orderer and peer) are the host names use by the vs code extension local fabric and these need to be excluded to stop the proxy from intercepting and trying handle these hosts

david_k
  • 5,843
  • 2
  • 9
  • 16
  • It was my pleasure @david_k, what you wrote in the official answer is exactly what happened to me. I was stranded in such a tricky issue that became annoying when I wanted to proceed with the next step in my own project. Thank you to show interest in solving the problem. – cgironda Aug 01 '19 at 14:38
0

Open the terminal and type this command. Hope it will work.

sudo chmod 666 /var/run/docker.sock