The bound address is already in use ошибка

In some cases it is critical to perform a more in-depth debugging to the problem before stopping a container or killing a process.

Consider following the checklist below:

1) Check you current docker compose environment
Run docker-compose ps.
If port is in use by another container, stop it with docker-compose stop <service-name-in-compose-file> or remove it by replacing stop with rm.

2) Check the containers running outside your current workspace
Run docker ps to see list of all containers running under your host.
If you find the port is in use by another container, you can stop it with docker stop <container-id>.
(*) Because you’re not under the scope of the origin compose environment — it is a good practice first to use docker inspect to gather more information about the container that you’re about to stop.

3) Check if port is used by other processes running on the host
For example if the port is 6379 run:

$ sudo netstat -ltnp | grep ':6379'
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      915/redis-server 12 
tcp6       0      0 ::1:6379                :::*                    LISTEN      915/redis-server 12

(*) You can also use the lsof command which is mainly used to retrieve information about files that are opened by various processes (I suggest running netstat before that).

So, In case of the output above the PID is 915. Now you can run:

$ ps j 915
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
    1   915   915   915 ?           -1 Ssl    123   0:11 /usr/bin/redis-server 127.0.0.1:6379

And see the ID of the parent process (PPID) and the execution command.
You can also run: $ pstree -s <PID> to a visual display of the process and its related processes.

In our case we can see that the process probably is a daemon (PPID is 1) — In that case consider running:
A) $ cat /proc/<PID>/status in order to get a more in-depth information about the process like the number of threads spawned by the process, its capabilities, etc’.
B) $ systemctl status <PID> in order to see the systemd unit that caused the creation of a specific process. If the service is not critical — you can stop and disable the service.

4) Restart Docker service
Run: sudo service docker restart.

5) You reached this point and..
Only if its not placing your system at risk — consider restarting the server.

  • #1

Господа! Прошу помощи настроить nbminer, имеется риг, 5 карт, 4 майнят на один кошелёк, одна на другой. 4 работают всё ок, при запуске второго майнера пишет такую ошибку
API server start failed: the bound address is already in use
что в настройках как прописать, или можно в одном майнере разделить карты с кошельками? может зря я второй запускаю?

  • #2

Другой манер запусти, и видяхи в батниках пропиши

  • #3

ты два раза один манер запускаешь?

да и инфы просто валом. Какая ос? полный лог и т.д.

  • #4

ты два раза один манер запускаешь?

да и инфы просто валом. Какая ос? полный лог и т.д.

да, так нельзя? вин10

[22:35:19] INFO — ——————- Device ——————-
[22:35:19] INFO — |ID|PCI| CC|Memory|CU|
[22:35:19] INFO — | 0| 1| 86| 8191M|46| NVIDIA GeForce RTX 3070
[22:35:19] INFO — | 1| 2| 86| 8191M|46| NVIDIA GeForce RTX 3070
[22:35:19] INFO — | 2| 3| 86| 8191M|46| NVIDIA GeForce RTX 3070
[22:35:19] INFO — | 3| 4| 86| 8191M|46| NVIDIA GeForce RTX 3070
[22:35:19] INFO — *| 4| 7| 86| 8191M|48| NVIDIA GeForce RTX 3070 Ti
[22:35:19] INFO — ———————————————-
[22:35:19] INFO — ethash — Logging in to ethash.poolbinance.com(13.248.162.234):443 …
[22:35:19] INFO — ethash — Login succeeded.
[22:35:19] INFO — ethash — New job: ethash.poolbinance.com:443, ID: 90863b24, HEIGHT: 199290, DIFF: 8.590G
[22:35:19] INFO — API: 0.0.0.0:22333
[22:35:19] WARN — API server start failed: The bound address is already in use

[21:25:48] INFO — ——————- Device ——————-
[21:25:48] INFO — |ID|PCI| CC|Memory|CU|
[21:25:48] INFO — *| 0| 1| 86| 8191M|46| NVIDIA GeForce RTX 3070
[21:25:48] INFO — *| 1| 2| 86| 8191M|46| NVIDIA GeForce RTX 3070
[21:25:48] INFO — *| 2| 3| 86| 8191M|46| NVIDIA GeForce RTX 3070
[21:25:48] INFO — *| 3| 4| 86| 8191M|46| NVIDIA GeForce RTX 3070
[21:25:48] INFO — | 4| 7| 86| 8191M|48| NVIDIA GeForce RTX 3070 Ti
[21:25:48] INFO — ———————————————-
[21:25:48] INFO — ethash — Logging in to ethash.poolbinance.com(76.223.62.235):8888 …
[21:25:48] INFO — ethash — Login succeeded.
[21:25:48] INFO — ethash — New job: ethash.poolbinance.com:8888, ID: f5adf2f0, HEIGHT: 1536130, DIFF: 8.590G
[21:25:48] INFO — API: 0.0.0.0:22333
[21:25:48] INFO — API server started.
[21:25:50] INFO — Device 1 started, Free mem = 7132 MB.
[21:25:52] INFO — Device 2 started, Free mem = 7132 MB.
[21:25:53] INFO — Light cache built, 2.44 s.
[21:25:54] INFO — Device 0 started, Free mem = 7132 MB.
[21:25:55] INFO — Device 1: DAG — Building, EPOCH 452
[21:25:56] INFO — Device 3 started, Free mem = 7132 MB.

  • #5

Можно. Напиши как ты в батниках все прописал.

  • #6

да, так нельзя? вин10

[22:35:19] INFO — ——————- Device ——————-
[22:35:19] INFO — |ID|PCI| CC|Memory|CU|
[22:35:19] INFO — | 0| 1| 86| 8191M|46| NVIDIA GeForce RTX 3070
[22:35:19] INFO — | 1| 2| 86| 8191M|46| NVIDIA GeForce RTX 3070
[22:35:19] INFO — | 2| 3| 86| 8191M|46| NVIDIA GeForce RTX 3070
[22:35:19] INFO — | 3| 4| 86| 8191M|46| NVIDIA GeForce RTX 3070
[22:35:19] INFO — *| 4| 7| 86| 8191M|48| NVIDIA GeForce RTX 3070 Ti
[22:35:19] INFO — ———————————————-
[22:35:19] INFO — ethash — Logging in to ethash.poolbinance.com(13.248.162.234):443 …
[22:35:19] INFO — ethash — Login succeeded.
[22:35:19] INFO — ethash — New job: ethash.poolbinance.com:443, ID: 90863b24, HEIGHT: 199290, DIFF: 8.590G
[22:35:19] INFO — API: 0.0.0.0:22333
[22:35:19] WARN — API server start failed: The bound address is already in use

[21:25:48] INFO — ——————- Device ——————-
[21:25:48] INFO — |ID|PCI| CC|Memory|CU|
[21:25:48] INFO — *| 0| 1| 86| 8191M|46| NVIDIA GeForce RTX 3070
[21:25:48] INFO — *| 1| 2| 86| 8191M|46| NVIDIA GeForce RTX 3070
[21:25:48] INFO — *| 2| 3| 86| 8191M|46| NVIDIA GeForce RTX 3070
[21:25:48] INFO — *| 3| 4| 86| 8191M|46| NVIDIA GeForce RTX 3070
[21:25:48] INFO — | 4| 7| 86| 8191M|48| NVIDIA GeForce RTX 3070 Ti
[21:25:48] INFO — ———————————————-
[21:25:48] INFO — ethash — Logging in to ethash.poolbinance.com(76.223.62.235):8888 …
[21:25:48] INFO — ethash — Login succeeded.
[21:25:48] INFO — ethash — New job: ethash.poolbinance.com:8888, ID: f5adf2f0, HEIGHT: 1536130, DIFF: 8.590G
[21:25:48] INFO — API: 0.0.0.0:22333
[21:25:48] INFO — API server started.
[21:25:50] INFO — Device 1 started, Free mem = 7132 MB.
[21:25:52] INFO — Device 2 started, Free mem = 7132 MB.
[21:25:53] INFO — Light cache built, 2.44 s.
[21:25:54] INFO — Device 0 started, Free mem = 7132 MB.
[21:25:55] INFO — Device 1: DAG — Building, EPOCH 452
[21:25:56] INFO — Device 3 started, Free mem = 7132 MB.

В винде можно, только в каждом майнере надо выбрать карты, которые он использует. А лучше два разных майнера использовать.

  • #7

Можно. Напиши как ты в батниках все прописал.

nbminer -a ethash -o stratum+tcp://ethash.poolbinance.com:8888 -u кошелёк -d 0,1,2,3 -log

nbminer -a ethash -o stratum+tcp://ethash.poolbinance.com:443 -u кошелёк2 -d 4 -log

порт неважно, это просто пробовал

  • #8

а если через —api попробовать другой порт задать для второго майнера?

  • #9

Вам правильно про порт написали, не будет работать два сервера на одном порте, у вас первый запуск майнера занял 22333 порт, второй запуск тоже попытался на нем поднять сервер и отвалился. Поищите в документации майнера как выставить другой порт и для второго майнера вместо 22333 сделайте 22444 например, главное больше 10000 и меньше 65536 вроде диапазон )

  • #10

прописал -api 0.0.0.0:22444
пока работает, далее посмотрим
Спасибо за помощь!

  • #12

Он же внятно пишет: порт уже занят. Либо ты запускаешь майнер второй раз, либо порт занят другим майнером или приложением. Посмотри, каким процессом занят порт.

Stuck with the Docker error “bind: address already in use”? We can help you.

Recently, we had a customer who came across this error when he tried to start a docker instance.

As part of our Docker Hosting services, we assist our customers with several Docker queries.

Today, let us see how to resolve this error.

Docker error “bind: address already in use”

While trying to start a docker instance, one of our customers came across the below error:

Error response from daemon: Cannot start container: listen tcp 0.0.0.0:9306: bind: address already in use

The major cause of this error can be another process using the same port.

Solution

1. To start the container successfully, we kill whatever is using the port.

Initially, we check what uses the port. If it is non-essential at this time, we kill it.

sudo lsof -i tcp:8080

In the prompt for the device password, we type it in and press enter. We can replace 8080 with whichever port we want.

Then, we will get a list of currently running processes. Look at the PID of the process. We need it to issue the kill command.

We need to find the process that is obstructing the desired port and ensure it is not of our need.

Then we run the below command to stop the process:

# sudo kill -9 PID
2. Change to another port by modifying the default port in the docker-compose.yml file.

However, if the process that uses the desired port is essential for our setup, we have to change the port for the docker instance.

Ensure to adjust any other project settings linking to this particular port to the new value we select.

Restart the container instance after doing this for changes to take effect.

To start a Docker container using a different port, our Support Techs suggest the steps below:

  • We find a free TCP port that we can use (for example, 8086)
  • Then we delete the existing container:
    docker rm docker_name

    When Docker creates a container, it assigns the ports to it. To change the ports, we delete the existing container first, then re-create it.

  • Finally, we restart with a different host port number, for example:
    docker run -d -p 8086:8080 -p 55555:55555 -p:80:80 –shm-size=2g –env username_admin_globalaccesslevel=admin –env username_admin_password=admin –name=docker_name solace/solace-pubsub-standard
3. If for any reason our host reboots.

This issue can happen when the host reboots.

In such a case, we restart our apache server. Stopping the apache2 service in the host can solve it.

$ sudo /etc/init.d/apache2 restart
or
$ sudo apachectl -k restart
4. If Nginx is running globally, it can be the reason too.
$ sudo nginx -s stop

This can happen when the same container runs at some other instance. In that case, docker ps is very helpful.

docker-compose down # Stop container on the current directory if there is a docker-compose.yml
docker rm -fv $(docker ps -aq) # Remove all containers
sudo lsof -i -P -n | grep  # List who is using the port

[Need help with the resolution? We’d be happy to assist]

Conclusion

In short, we saw the methods our Support Techs employ in order to fix the Docker error “bind: address already in use”.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Автор Тема: QTcpServer Ошибка : The bound address is already in use  (Прочитано 7239 раз)
garryHotDog

Гость


Есть консольное приложение  в Ubuntu которое прослушивает определенный ip и порт, если приложение вылетает (по внутренним причинам), то при следующем запуске появляется ошибка The bound address is already in use…хотя NETSTAT показывает что такой адрес не занят!?….если программу закрыть через (ctrl+z) и потом снова запустить, то снова появляется такая же ошибка….пробовал ждать определенное время, все равно пишет ошибку…..попробовал загнать процедуру listen() в цикл (ну типа если не может начать прослушку пробовать снова 50 раз) — не помогло…..подскажите что нибудть, может кто-нибудь сталкивался с такой проблемой!?


Записан
crossly

Гость


а netstat c какими параметрами запускали ?


Записан
garryHotDog

Гость


пробовал по разному….теоретически, если прога вылетела, то сокет должен был закрыться!? ведь так!?


Записан
crossly

Гость


по идее да…. на win или linux??


Записан
garryHotDog

Гость


ubuntu server 9.10


Записан
crossly

Гость


что говорит

Код:

fuser <порт>/tcp

??


Записан
garryHotDog

Гость


попробую скажу…


Записан
garryHotDog

Гость


Цитировать

fuser <порт>/tcp

показал pid процесса — оказалось прога после падения — висит в памяти!


Записан

1. Overview

Docker is a platform that allows us to create and run applications in isolated lightweight containers.

In this tutorial, we’ll learn to resolve the issues related to the port binding on a Docker container. This is one of the most common errors that beginners face while working with Docker. We’ll also examine the root cause of this issue, and different approaches to solving it.

2. Understanding the Problem

In Docker, the issue “address already in use” occurs when we try to expose a container port that’s already acquired on the host machine.

To resolve the issue, we first need to reproduce the problem. Let’s assume that port 8080 on the Docker host machine is already occupied. There could be multiple reasons for this, like the Tomcat server has occupied this port, or some random process is using it.

We’ll try to run a Docker container and expose the same port 8080 on the host:

$ docker run -itd -e POSTGRES_USER=baeldung -e POSTGRES_PASSWORD=baeldung
  -p 8080:5432 -v /data:/var/lib/postgresql/data --name postgresql-baeldung postgres
Unable to find image 'postgres:latest' locally
latest: Pulling from library/postgres
42c077c10790: Already exists 
3c2843bc3122: Pull complete 
...
ad029fbc8984: Pull complete 
Digest: sha256:2d1e636f07781d4799b3f2edbff78a0a5494f24c4512cb56a83ebfd0e04ec074
Status: Downloaded newer image for postgres:latest
22e97efd420eee8ba2d77a956933d00b04784b0b04c97ffc09e127f10932dea9
docker: Error response from daemon: driver failed programming external connectivity
  on endpoint postgresql-baeldung (154f66d3ba8bee4dafba092137311c43b950c31884e199d34d2b1d301496f9b5):
  Error starting userland proxy: listen tcp 0.0.0.0:8080: bind: address already in use.

In the above output, port 8080 has already been acquired, so we can’t run the Docker container. Since the container failed to start, we must remove it as well. Let’s take a look at the command to remove the Docker container:

$ docker rm -f  postgresql-baeldung
postgresql-baeldung

Here we successfully removed the “postgresql-baeldung” Docker container.

3. Solving the Bind Address Issue

So far, we’ve reproduced the issue and discussed the root cause of the problem. Now let’s explore the possible ways to resolve it.

3.1. Killing the Process

The Error “address already in use” occurred because some process was already running on the same port. So we can resolve the issue just by killing the process.

To stop the process, we need the process ID (PID), which we can fetch using the lsof command. The lsof command lets us know which processes open which files, so we can use this command to know the PID of the process running on a particular port. By default, the lsof package isn’t installed in Linux.

Let’s look at the command to install the lsof:

$ yum install -y  lsof

Using the above command, we successfully installed the lsof package. Now let’s see the command to get the PID of the process using the lsof command:

$ lsof -i:8080
COMMAND     PID  USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java      78812 root   66u  IPv6 0xe28ed26f1f48e597      0t0  TCP *:http-alt (LISTEN)

In the output of the above command, we can see that a Java process is already running on the 8080 port, causing the “Error bind: address already in use” issue. To resolve the issue, we need to kill this process using the kill command:

$ kill 78812

Now we can run our container without any issues:

$ docker run -itd -e POSTGRES_USER=baeldung -e POSTGRES_PASSWORD=baeldung
  -p 8080:5432 -v /data:/var/lib/postgresql/data --name postgresql-baeldung postgres
  154f66d3ba8bee4dafba092137311c43b950c31884e199d34d2b1d301496f9b5

This time, the Docker container ran successfully without any port conflict.

3.2. Expose Free Port

We can also resolve the above issue by exposing a free port while running the Docker container. We can find open ports in Linux using the ss or netstat command:

$ docker run -itd -e POSTGRES_USER=baeldung -e POSTGRES_PASSWORD=baeldung  -p 8082:5432 -v /data:/var/lib/postgresql/data --name postgresql-baeldung postgres
  154f66d3ba8bee4dafba092137311c43b950c31884e199d34d2b1d301496f9b5

It’s important to make sure we remove the stopped container “postgresql-baeldung” before running the fresh container.

4. Similar Port Binding Issue

In Docker, we can also face another issue similar to the “Error bind: address already in use.” In this issue, we get the following error:

"Bind for 0.0.0.0:8080 failed: port is already allocated."

The “port is already allocated” issue occurs if we run two different Docker containers on the same port. Let’s run the “postgresql-baeldung” container on 8080 port:

$ docker run -itd -e POSTGRES_USER=baeldung -e POSTGRES_PASSWORD=baeldung  -p 8080:5432 -v /data:/var/lib/postgresql/data --name postgresql-baeldung postgres
  5bddeacbe97229e4ee9cf2ed571fea309651f6cf6fecf433f22255e8cc506277
docker: Error response from daemon: driver failed programming external connectivity
  on endpoint postgresql-baeldung (b3469040c1fe37509c792e206e68d02ccc95a51b3353809b9462d15f6d670cc9):
  Bind for 0.0.0.0:8080 failed: port is already allocated.

The solution to the “Bind for 0.0.0.0:8080 failed: port is already allocated” issue is similar to the one discussed above. All we need to do is either free up the port, or use another available port.

One of the key differences between the issues is that the “address already in use” issue occurs when we run a Docker container on a port where a process is already running on the host, while the “port is already allocated” issue occurs when we try to run a Docker container with the same port on which a Docker container is already running.

5. Conclusion

In this article, we demonstrated how to resolve the “address already in use” issue in Docker. First, we analyzed the cause of the issue. Then we resolved it using different methods. Finally, we explored a similar issue related to the bind address.

Понравилась статья? Поделить с друзьями:
  • The binding of isaac комната ошибка
  • The binding of isaac код ошибки 51
  • The binding of isaac repentance ошибка 0xe06d7363
  • The binding of isaac repentance ошибка 0xc0000142
  • The binding of isaac repentance ошибка 0xc000007b