logspout icon indicating copy to clipboard operation
logspout copied to clipboard

0.0.0.0:80: bind: address already in use, errors in logs

Open biguphpc opened this issue 5 years ago • 4 comments

Hi, we've having constant errors in the logs when starting this container.

...more
2020/07/24 16:29:22 http[logs,routes]:80 ended: listen tcp 0.0.0.0:80: bind: address already in use,
# logspout v3.2.6-custom by gliderlabs,
# adapters: logdna,
# options : persist:/mnt/routes,
# jobs    : pump routes http[logs,routes]:80,
# routes  :,
#   ADAPTER	ADDRESS	CONTAINERS	SOURCES	OPTIONS,
#   logdna					map[],
2020/07/24 16:30:22 http[logs,routes]:80 ended: listen tcp 0.0.0.0:80: bind: address already in use,
# logspout v3.2.6-custom by gliderlabs,
# adapters: logdna,
# options : persist:/mnt/routes,
# jobs    : http[logs,routes]:80 pump routes,
# routes  :,
#   ADAPTER	ADDRESS	CONTAINERS	SOURCES	OPTIONS,
#   logdna					map[],
2020/07/24 16:31:23 http[logs,routes]:80 ended: listen tcp 0.0.0.0:80: bind: address already in use,
...more

This seems to happen every minute. Here's the docker-compose.yaml we're using:

version: '3'
services:
  logdna-containers:
    image: logdna/logspout:latest
    restart: unless-stopped
    network_mode: host
    hostname: logdna-containers
    container_name: logdna-containers
    environment:
        LOGDNA_KEY: "xxxx"
        TAGS: "container"
    volumes:
      - /etc/hostname:/etc/host_hostname:ro
      - /var/run/docker.sock:/var/run/docker.sock
  1. Can you tell us what is going on ?
  2. What is the use of listening to port 80 ?

Thanks

biguphpc avatar Jul 24 '20 16:07 biguphpc

hi @biguphpc thank you for opening this issue! @smusali and I are looking into this and will get back to you.

Does this issue also surface if you use one of our other available Docker setup methods? For example:

sudo docker run --name="logdna" --restart=always \
-d -v=/var/run/docker.sock:/var/run/docker.sock \
-e LOGDNA_KEY="<LogDNA Ingestion Key>" \
logdna/logspout:latest 

Also do you have any other processes running on port 80? You can run lsof -i:80 to check and send a kill -9 with the associated pid (https://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac)

dm36 avatar Jul 24 '20 20:07 dm36

Yes we do have other processes running on port 80 and do not want to kill our web server running on port 80. This only happens when the container is runs on bridge networking mode.

biguphpc avatar Jul 31 '20 15:07 biguphpc

I understand @biguphpc. So it looks like official logspout listens on port 80 by default (https://github.com/gliderlabs/logspout) and it can be configured via the PORT variable (see the environment variable section of the logspout README). Would update the environment section in your docker compose file to contain the desired port.

Environment variables (section in the official logspout README): PORT or HTTP_PORT - configure which port to listen on (default 80)

Sample docker compose file using the PORT environment variable:

 version: '3'
 services:
   logdna-containers:
     image: logdna/logspout:latest
     restart: unless-stopped
     network_mode: host
     hostname: logdna-containers
     container_name: logdna-containers
     environment:
         LOGDNA_KEY: "xxxx"
         TAGS: "container"
         PORT: 90
     volumes:
       - /etc/hostname:/etc/host_hostname:ro
       - /var/run/docker.sock:/var/run/docker.sock

dm36 avatar Aug 03 '20 17:08 dm36

@biguphpc following up- did that help resolve your issue?

dm36 avatar Aug 04 '20 20:08 dm36