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

Error: Error endorsing chaincode: rpc error: code = Unknown desc = error starting container: cannot connect to Docker endpoint #27

Closed
SKD-SKD opened this issue Nov 14, 2018 · 10 comments

Comments

@SKD-SKD
Copy link

SKD-SKD commented Nov 14, 2018

running in IBM container cloud ,
getting :
error on the chaincodeinstantiate pods:

kubectl get pods
NAME READY STATUS RESTARTS AGE
blockchain-ca-645b8f67fc-jrg5n 1/1 Running 0 48m
blockchain-orderer-b5679c968-dvm4f 1/1 Running 0 48m
blockchain-org1peer1-54c689bbd5-kqbqm 1/1 Running 0 48m
blockchain-org2peer1-7768db4f98-qnfhd 1/1 Running 0 48m
blockchain-org3peer1-56ff98b9d6-t4shb 1/1 Running 0 48m
blockchain-org4peer1-7cf44cb7bb-9flzk 1/1 Running 0 48m
chaincodeinstall-tn74d 0/4 Completed 0 48m
chaincodeinstantiate-gqlcr 0/1 Error 0 23m
chaincodeinstantiate-vmz2x 0/1 Error 0 23m
copyartifacts-fg9ql 0/1 Completed 0 53m
createchannel-jnbmb 0/2 Completed 0 48m
joinchannel-d4pjn 0/4 Completed 0 48m
utils-w5fnq 0/2 Completed 0 51m

kubectl logs chaincodeinstantiate-gqlcr
2018-11-14 19:47:34.091 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-11-14 19:47:34.092 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: Error endorsing chaincode: rpc error: code = Unknown desc = error starting container: cannot connect to Docker endpoint

@SKD-SKD
Copy link
Author

SKD-SKD commented Nov 14, 2018

Kubernetes version
1.12.2_1527

@SKD-SKD
Copy link
Author

SKD-SKD commented Nov 14, 2018

with Kubernetes version . 1.9.10_1530 in IBM Kube , deployment works well

@AnthonyAmanse
Copy link
Contributor

@SKD-SKD IKS v1.11 and onwards now use containerd as its container runtime instead of the docker engine therefore using docker.sock is no longer possible. Pull request #28 would deploy a docker daemon in the cluster that could be used by the chaincode containers.

@SKD-SKD
Copy link
Author

SKD-SKD commented Nov 15, 2018

i v tried with #28 changes in IBM kube ver 1.12.2_1527 . again.
same problem ,

something else i am doing wrong ?

@SKD-SKD
Copy link
Author

SKD-SKD commented Nov 15, 2018

$ kubectl get pods
NAME READY STATUS RESTARTS AGE
blockchain-ca-645b8f67fc-hjtvg 1/1 Running 0 11m
blockchain-orderer-b5679c968-m4wdk 1/1 Running 0 11m
blockchain-org1peer1-54c689bbd5-4kdg5 1/1 Running 0 11m
blockchain-org2peer1-7768db4f98-8254t 1/1 Running 0 11m
blockchain-org3peer1-56ff98b9d6-cs8w4 1/1 Running 0 11m
blockchain-org4peer1-7cf44cb7bb-t2ghc 1/1 Running 0 11m
chaincodeinstall-g7kk7 0/4 Completed 0 11m
chaincodeinstantiate-q68vb 0/1 Error 0 10m
chaincodeinstantiate-zxxsl 0/1 Error 0 10m
copyartifacts-46px5 0/1 Completed 0 12m
createchannel-2sxxx 0/2 Completed 0 11m
docker-dind-686f674f4c-gj9hz 1/1 Running 0 12m
joinchannel-cqzpv 0/4 Completed 0 11m
utils-pt6nl 0/2 Completed 0 11m
sergeyxs-MacBook:blockchain-network-on-kubernetes-master-28 sergey$ kubectl logs chaincodeinstantiate-q68vb
2018-11-15 18:17:33.796 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-11-15 18:17:33.796 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: Error endorsing chaincode: rpc error: code = Unknown desc = error starting container: cannot connect to Docker endpoint
Usage: .....
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
10.182.132.132 Ready 1d v1.12.2+IKS
$

@SKD-SKD
Copy link
Author

SKD-SKD commented Nov 15, 2018

to make "./setup_blockchainNetwork.s" to Create Docker deployment , i had to # comment out if :

Create Docker deployment

#if [ "$(cat configFiles/peersDeployment.yaml | grep -c tcp://docker:2375)" != "0" ]; then
echo "peersDeployment.yaml file was configured to use Docker in a container."
echo "Creating Docker deployment"

kubectl create -f ${KUBECONFIG_FOLDER}/docker-volume.yaml
kubectl create -f ${KUBECONFIG_FOLDER}/docker.yaml
sleep 5

dockerPodStatus=$(kubectl get pods --selector=name=docker --output=jsonpath={.items..phase})

while [ "${dockerPodStatus}" != "Running" ]; do
    echo "Wating for Docker container to run. Current status of Docker is ${dockerPodStatus}"
    sleep 5;
    if [ "${dockerPodStatus}" == "Error" ]; then
        echo "There is an error in the Docker pod. Please check logs."
        exit 1
    fi
    dockerPodStatus=$(kubectl get pods --selector=name=docker --output=jsonpath={.items..phase})
done

#fi

please correct my steps

@AnthonyAmanse
Copy link
Contributor

@SKD-SKD Hi, I did modify the README to mention if you're using v1.11+ of k8s.

https://github.com/AnthonyAmanse/blockchain-network-on-kubernetes/blame/dev-anthony/README.md#L144-L156


If the Kubernetes' Server version is v1.11.x or above, the cluster may be using containerd as its container runtime therefore using docker.sock of the worker node is not possible. You could deploy and use a Docker daemon in a container.

In IKS v1.11.x and above, it is using containerd

Modify the configFiles/peersDeployment.yaml file to point to a Docker service. Change instances of unix:///host/var/run/docker.sock to tcp://docker:2375 with a text editor or use the commands below.

## macOS
$ sed -i '' s#unix:///host/var/run/docker.sock#tcp://docker:2375# configFiles/peersDeployment.yaml
## Linux
$ sed -i s#unix:///host/var/run/docker.sock#tcp://docker:2375# configFiles/peersDeployment.yaml

So that if you modify that yaml file, the script will know that you're trying to deploy and use a docker daemon in a container.

@SKD-SKD
Copy link
Author

SKD-SKD commented Nov 15, 2018

all good ! script finished successfully,
thank you !

@maheshwarishikha
Copy link
Contributor

Thanks @SKD-SKD and @AnthonyAmanse. Will merge this PR.

@woodyjon
Copy link

Hello,

I am using latest version of Kubernetes (1.17.2), so > 1.11 and I made the changes mentioned: deploy a docker pod (dind) with configFiles/docker.yaml and configFiles/docker-volume.yaml and changed unix:///host/var/run/docker.sock to tcp://docker:2375, but the install of the chaincode does not work. On the peer, it says:

Error: chaincode install failed with status: 500 - failed to invoke backing implementation of 'InstallChaincode': could not build chaincode: docker build failed: docker image inspection failed: cannot connect to Docker endpoint

So it seems it cannot connect to the Docker endpoint. But I cannot find how to fix this.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants