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

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?

Related

Hyperledger-Fabric network.sh not working

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)

Docker: Error starting userland proxy: Bind for 0.0.0.0:50000: unexpected error Permission denied on Azure VM

I'm new to Docker so please be kind but I am testing it out on a Windows 10 image on Azure (I know I could run it directly but I wanted to try it in a VM first).
I have a fresh Windows 10 image that I have installed Docker for Windows 2.0.0 on.
Note: I did not tick the option to use Windows containers instead of linux containers.
Once it installed (and rebooted) I was prompted to install Hyper-V and Containers features (causing restarts).
Once it was all installed I open an Administrative PowerShell window to download Jenkins:
docker run -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
This gave me the error:
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: driver failed programming external connectivity on endpoint goofy_lederberg (deaba2deeea0486c92ba8a1a32740295f03859b1b5829d39e39eff0b24613ebf): Error starting userland proxy: Bind for 0.0.0.0:50000: unexpected error Permission denied.
I thought this was strange as 50000 wasn't a port that I expected to be in use, changing this to different ports (50001) produced the same error.
Running:
netstat -a -n -o
Showed that the port was not in use.
If I remove -p 50000:50000 from the command it can bind and start Jenkins but I assume it needs this port mapping to work correctly.
Previous posts have suggested stopping the World Wide Web Publishing service but that isn't installed.
There are no other running Docker containers.
I assume the port is in use or something is stopping the port mapping.
Assuming a user has permission to create a port binding from their terminal are there any other techniques beside netstat to determine if something is bound to a port - either something internal to docker's own checking process or something at the host OS level?
Rather embarrassingly this worked this morning with no changes other than the VM was shutdown over the weekend.
Maybe all it needed was a reboot?

Docker-Compose Postgres 5432 Bind: Address already in use error

Alright so I've been searching for 3-4 days now and I can't seem to find a solution to my error. I have found similar errors, and some that seemed to be describing my exact issue but none of the solutions worked.
I'm trying to get a simply postgres, express, node app up and running. I want to be able to run docker-compose up -d and have it build all of the images, volumes, etc. Then I will run a bash script that will seed my postgres db with data. However, I keep getting an error with the ports I'm using. I've removed all of my images, containers, and even reinstalled docker but I can't figure it out. I removed everything from my docker-compose except for the postgres and it still doesn't work.
version: '3'
services:
postgres:
image: postgres:10.0
volumes:
- /var/lib/postgresql/data
ports:
- '5432:5432'
Then on my host machine I simply plan on running the following bash script.
#!/bin/bash
host="postgres.dev"
adminUser="postgres"
psql -h $host -U $adminUser -c "select 1 from pg_database where datname = 'table_name';" | grep -q 1 || psql -h $host -U $adminUser -f ./"$(dirname $0)"/init-local-db.sql
I know that this approach should work since I'm patterning it after a work project...which works for them. But here's the error I get:
ERROR: for pg-db Cannot start service postgres: driver failed programming external connectivity on endpoint pg-db (b3e5697cd563264250479682ec83d4a232d0d4bd679a787ad2089e944dda9e2f): Error starting userland proxy: listen tcp 0.0.0Creating test-api ... done
ERROR: for postgres Cannot start service postgres: driver failed programming external connectivity on endpoint pg-db (b3e5697cd563264250479682ec83d4a232d0d4bd679a787ad2089e944dda9e2f): Error starting userland proxy: listen tcp 0.0.0.0:5432: bind: address already in use
ERROR: Encountered errors while bringing up the project.
I know some people say to simply change the port number so '5433:5432' but my problem with this is that when you install postgres by default its port is 5432, and I know it's not necessary to change it(because the work project doesn't). Any thoughts?
Update (next morning):
Okay I still have no idea why the error popped up in the first place, as I used lsof -i tcp:5432 (along with netstat) and nothing came up as using that port. I put my computer in suspend mode and went to bed. In the morning I woke up, changed my postgres version to 9.6 to see if that was it, and everything worked. I then switched it back to postgres 10.0 and again everything worked. Hopefully it won't pop back up again, but I have no idea why it popped up in the first place.
There is only one reason you may be getting this error. You have PostgreSQL installed on your local machine and it's running, occupying the port 5432.
You have the following options:
Disable (and remove from startup) PostgreSQL on your local machine. - Your Docker Compose will run.
sudo service postgresql stop
sudo update-rc.d postgresql disable
Use a different port in docker-compose. There is nothing wrong with applying '5433:5432'. Other services of your docker-compose will connect to postgres by 5432 port. From your local machine you'll be able you address postgres by localhost:5433.

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.

Docker fails at first run after install. Error Post http://..... permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?

I'm following step one of this docker tutorial.
I have installed ubuntu version 14.04 on a virtual box vm.
I intentionally downgraded by docker version so that when I type "docker version" I get Client version: 1.5.0. This is because the server I intend to communicate with is on 1.5.0.
When trying the command "docker run hello-world" I get the response:
"Post http:///var/run/docker.sock/v1.17/containers/create: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?"
When running "sudo docker run hello-world" I get the response:
Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
Can someone please explain to me what's happening and how can fix it?
Thanks.
Edit: I tried to follow the solution for Linux here
However,
I had tried to follow El Mesa's instructions in that post. However, when I got to running sudo docker -d I got an Error running DeviceCreate (createPool) dm_task_run failed. I don't think I need to start up a anything since I was just following the tutorial and the tutorial just did docker run hello-world immediately after installing docker
Pay attention to the text that immediately preceeds Are you trying to connect to a TLS-enabled daemon without TLS in the error message. In the question asked here it is permission denied, but it could also be no such file or directory (or possibly something else). The former is more likely to mean that the current user is lacking permissions to access docker, and the latter is more likely to mean that there is a problem with the docker service itself, including the possibility that it is not running at all.
So depending on what your situation is look for the answers on this and the
linked question page that focus on the respective problem area.
In my case (CentOS Linux release 7.1.1503 (Core), docker-1.7.1-108.el7.centos.x86_64) it was permission denied. I have added user to the docker group (sudo usermod -a -G docker user) but docker command still didn't work when I ran it under user, while it ran fine under sudo. What I forgot to do is log the user out and back in after adding it to the docker group, which is a step necessary for the group membership to take effect.
Restarting the machine will also solve this issue but it is a more drastic step and will work because it will imply log out / log in step. I would recommend trying to log out and back in before restarting because if it works it will give you more confidence that the group membership was the actual issue. And if it doesn't work you can always try restarting, though if it works after that it will probably work because restarting took care of some other underlying issue.
And one more thing in case you come across it and find yourself in doubt - when you first install docker and wish to add user to the docker group, you may notice (as I did in my case) that the "dockerroot" group exists but not "docker" group. Do not add user to the dockerroot group assuming that is the one you need. Instead create new docker group and add the user to it.
It may be that your docker daemon is not running.
I have ubuntu/docker on a desktop with wireless LAN.
It acts a bit finicky compared to the wired computers from which docker works OK, and duplicates the error message you reported:
$ docker run -it ubuntu:latest /bin/bash
FATA[0000] Post http:///var/run/docker.sock/v1.17/containers/create: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
However, after running:
sudo service docker start
It behaves correctly (at least until the host is rebooted):
$ docker run -it ubuntu:latest /bin/bash
root#2cea4e5f5028:/#
If the system is not starting the docker daemon on boot, as was the case here, then the docker daemon can be automatically started on boot by editing /etc/rc.local to do so. Add the line below immediately before the exit line. This will fork a new bash shell, wait 30 sec for the network setup, etc., to settle, and start the docker daemon. sudo is unnecessary here because /etc/rc.local runs as root.
( sleep 30; /usr/sbin/service docker start ) &

Resources