Run Kong with port 80, got Nginx error 13, can't bind 0.0.0.0:80


#1

Hello,

I’m trying to install KongA with KongHQ.

Here’s my setup: KongA:1337 + KongHQ:80/443

My docker-composer file:

version: “3”

networks:
kong-net:
driver: bridge

services:

#######################################

Postgres: The database used by Kong

#######################################
kong-database:
image: postgres:9.6
restart: always
networks:
- kong-net
environment:
POSTGRES_USER: kong
POSTGRES_DB: kong
ports:
- “5432:5432”
healthcheck:
test: [“CMD”, “pg_isready”, “-U”, “kong”]
interval: 5s
timeout: 5s
retries: 5

#######################################

Kong database migration

#######################################
kong-migration:
image: kong:latest
command: “kong migrations bootstrap”
networks:
- kong-net
restart: on-failure
environment:
KONG_PG_HOST: kong-database
links:
- kong-database
depends_on:
- kong-database

#######################################

Kong: The API Gateway

#######################################
kong:
image: kong:latest
restart: always
networks:
- kong-net
environment:
KONG_PG_HOST: kong-database
KONG_PROXY_LISTEN: 0.0.0.0:80
KONG_PROXY_LISTEN_SSL: 0.0.0.0:443
KONG_ADMIN_LISTEN: 0.0.0.0:8001
KONG_ADMIN_LISTEN: 0.0.0.0:8444
depends_on:
- kong-migration
- kong-database
healthcheck:
test: [“CMD”, “curl”, “-f”, “http://kong:8001”]
interval: 5s
timeout: 2s
retries: 15
ports:
- “8001:8001”
- “80:80”
- “441:443”
- “8444:8444”

#######################################

Konga database prepare

#######################################
konga-prepare:
image: pantsel/konga:next
command: “-c prepare -a postgres -u postgresql://kong@kong-database:5432/konga_db”
networks:
- kong-net
restart: on-failure
links:
- kong-database
depends_on:
- kong-database

#######################################

Konga: Kong GUI

#######################################
konga:
image: pantsel/konga:next
restart: always
networks:
- kong-net
environment:
DB_ADAPTER: postgres
DB_HOST: kong-database
DB_USER: kong
TOKEN_SECRET: km1GUr4RkcQD7DewhJPNXrCuZwcKmqjb
DB_DATABASE: konga_db
NODE_ENV: production
depends_on:
- kong-database
ports:
- “1337:1337”

After running docker-compose up I got the error kong_1 | nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)

Can you please show me where I’m doing wrong?

Thank you!


#2

Well 80 is a reserved port. I would look into binding to 8080 for easy way out, or run that command that lets you map a process to a reserved port:

-Jeremy