Hyperledger-Fabric network.sh not working - hyperledger-fabric

When I run the network.sh up command I get as result " ERROR: for peer0.org1.example.com Cannot start service peer0.org1.example.com: driver failed programming external connectivity on endpoint peer0.org1.example.com (9dace0451ce23579ca2750b24f788c04c566e9007534c6cf6e472c0bd204ba28): Error starting userland proxy: listen tcp4 0.0.0.0:7051: bind: address already in use"
Can someone help me please

As per my thought, there were 2 cases:
It was some other process that is also using port 7051. So you have to remove that particular process as per your os that will help you in solving the problem.
As in other cases, it mostly is the same container running at some other instance. In that case, verify using docker ps It shows a list of containers, and if the same containers running in other directories and then try running again at other places where the container name is the same. for that, you have to remove all the containers.
Command:
docker kill $(docker ps -q)
docker rm -f $(docker ps -aq)

Related

What can I do when bind: adress already in use?

When I want to run my network with hyperledger fabric v. 2 and couchdb I get following error for all couchdb and ppeers:
WARNING: Host is already in use by another container
ERROR: for ca_peerOrg1 Cannot start service ca0: driver failed programming external connectivity on endpoint ca_peerOrg1 (e1ebe2f0cbdbddf0a1873a3db798e21ecd9aa5bac1944eb522bddaedabc87eba): Error starting userland proxy: listen tcp 0.0.0.0:7054: bind: address already in use
Creating ca_peerOrg2 ... error
What I have done so far, but wasn't helping:
docker rm -f $(docker ps -a -q)
Then I wanted to stop docker compose, by follwoing command:
docker-compose stop
But I got some errors, and actually I installed docker compose before.
Then I removed the images and installed them again with the commands:
I am always working in the same project. Just starting it sometimes again, to solve some errors.
I do not understand, how I can all bring down and up again.
For starting my network I use following command:
sudo ./start_Network.sh
If I want to use sudo ./start_Network.sh down is not working.
What can I do to solve my errors?

Dockerized nginx shuts down after a few seconds

I'm working with Ubuntu 18 and I´m trying to run a dockerized nginx with a shared file between the host machine and the container: /home/ric/wrkspc/djangodocker/djangodocker/nginx.conf
I do so by running the following command, after which I'm prompted with container's ID:
$ sudo docker container run -v /home/ric/wrkspc/djangodocker/djangodocker/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx
facc4d32db31de85d6f360e581bc7d36f257ff66953814e985ce6bdf708c3ad0
Now, if I try to list all the running containers, the nginx one doesn't appear listed:
(env) ric#x:~/wrkspc/djangodocker/djangodocker$ sudo docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
36090ff0759c mysql "docker-entrypoint.s…" 3 days ago Up 3 days 0.0.0.0:3306->3306/tcp, 33060/tcp boring_panini
Sometimes, if I run the docker ls command fast enough, I can see the nginx container listed for just a few seconds and then it disappears.
Why is the nginx container not being listed?
I think container immediately exits after started.
can you troubleshoot by looking into docker logs using the command
docker logs containerID
Also, you can try running the container interactively to identify the error without using -d option

Error while using docker run

I'm new to using Docker and I am trying to follow a tutorial on this link which requires using a Docker. I have successfully installed the Docker on Ubuntu with the Docker docs tutorial.
I am following Option A and have completed steps 1,2, and 3. For 3 I had to precede the statement by sudo in order to get it work. However, when I try to run step 4 using the command docker run -it -p 8888:8888 -v <path to repo>:/root mlatberkeley/showandtell, I get the following error:
docker: Error response from daemon: driver failed programming external connectivity on endpoint eager_pasteur (fb195057d626924#####################3d3d6f24071497fc443fbd8c9): Error starting userland proxy: listen tcp 0.0.0.0:8888: bind: address already in use.
I have hashed some of the string of numbers above in the output error. I am new to Docker and I would be grateful for some suggestion to resolve the error.
There seems to be another process that is binded on port 8888.
To find this process run the command sudo netstat -tulpn | grep :8888. This will show you the process pid in the last column.
This might be a docker container that you have started previously. In that case try to remove the container by running docker container ls and then docker container rm -f <container-name-from-prev-command>. You can also start the new container on a new port, by replacing 8888:8888 with 9999:8888.

Cannot setup multi-host Docker overlay network with etcd

I am trying to connect two Docker hosts with an overlay network and am using etcd as a KV-store. etcd is running directly on the first host (not in a container). I finally managed to connect the Docker daemon of the first host to etcd but cannot manage to establish a connection the Docker daemon on the second host.
I downloaded etcd from the Github releases page and followed the instructions under the "Linux" section.
After starting etcd, it is listening to the following ports:
etcdmain: listening for peers on http://localhost:2380
etcdmain: listening for peers on http://localhost:7001
etcdmain: listening for client requests on http://localhost:2379
etcdmain: listening for client requests on http://localhost:4001
And I started the Docker daemon on the first host (on which etcd is running as well) like this:
docker daemon --cluster-advertise eth1:2379 --cluster-store etcd://127.0.0.1:2379
After that, I could also create an overlay network with:
docker network create -d overlay <network name>
But I can't figure out how to start the daemon on the second host. No matter which values I tried for --cluster-advertise and --cluster-store, I keep getting the following error message:
discovery error: client: etcd cluster is unavailable or misconfigured
Both my hosts are using the eth1 interface. The IP of host1 is 10.10.10.10 and the IP of host2 is 10.10.10.20. I already ran iperf to make sure they can connect to each other.
Any ideas?
So I finally figured out how to connect the two hosts and to be honest, I don't understand why it took me so long to solve the problem. But in case other people run into the same problem I will post my solution here. As mentioned earlier, I downloaded etcd from the Github release page and extracted the tar file.
I followed the instructions from the etcd documentation and applied it to my situation. Instead of running etcd with all the options directly from the command line I created a simple bash script. This makes it a lot easier to adjust the options and rerun the command. Once you figured out the right options it would be handy to place them separately in a config file and run etcd as a service as explaind in this tutorial. So here is my bash script:
#!/bin/bash
./etcd --name infra0 \
--initial-advertise-peer-urls http://10.10.10.10:2380 \
--listen-peer-urls http://10.10.10.10:2380 \
--listen-client-urls http://10.10.10.10:2379,http://127.0.0.1:2379 \
--advertise-client-urls http://10.10.10.10:2379 \
--initial-cluster-token etcd-cluster-1 \
--initial-cluster infra0=http://10.10.10.10:2380,infra1=http://10.10.10.20:2380 \
--initial-cluster-state new
I placed this file in the etcd-vX.X.X-linux-amd64 directory (that I just downloaded and extracted) which also contains the etcd binary. On the second host I did the same thing but changed the --name from infra0 to infra1 and adjusted the IP to that one the second host (10.10.10.20). The --initial-cluster option is not modified.
Then I executed the script on host1 first and then on host2. I'm not sure if the order matters, but in my case I got an error message when I did it the other way round.
To make sure your cluster is set up correctly you can run:
./etcdctl cluster-health
If the output looks similar to this (listing the two members) it should work.
member 357e60d488ae5ab3 is healthy: got healthy result from http://10.10.10.10:2379
member 590f234979b9a5ee is healthy: got healthy result from http://10.10.10.20:2379
If you want to be really sure, add a value to your store on host1 and retrieve it on host2:
host1$ ./etcdctl set myKey myValue
host2$ ./etcdctl get myKey
Setting up docker overlay network
In order to set up a docker overlay network I had to restart the Docker daemon with the --cluster-store and --cluster-advertise options. My solution is probably not the cleanest one but it works. So on both hosts first stopped the docker service and then restarted the daemon with the options:
sudo service docker stop
sudo /usr/bin/docker daemon --cluster-store=etcd://10.10.10.10:2379 --cluster-advertise=10.10.10.10:2379
Note that on host2 the IP addresses need to be adjusted. Then I created the overlay network like this on one of the hosts:
sudo docker network create -d overlay <network name>
If everything worked correctly, the overlay network can now be seen on the other host. Check with this command:
sudo docker network ls

Can't access from outside process running in a Docker container

I'm trying to run a gameserver inside a docker container on my server but I'm having troubles connecting to it.
I created my container and started my gameserver (which is using port 7777) inside it.
I'm running the container with this command:
docker run -p 7777:7777 -v /home/gameserver/:/home -c=1024 -m=1024m -d --name my_gameserver game
I published the ports 7777 with the -p parameter but I can't connect to my gameserver, even though logs show that it is started.
I think I should bind my IP in some way but I have no idea what to do.
What I found so far is that docker inspect my_gameserver | grep IPAddress returns 172.17.0.24.
The problem was coming from the fact that I didn't expose the UDP port.
Correct command was:
docker run -p 7777:7777 -p 7777:7777/udp -v -d --name my_gameserver game

Resources