Skip to content

java.net.SocketException: Permission denied #117

@dtvuong

Description

@dtvuong

Describe the bug
I got the below error when docker-compose up.

Recreating local-data-api_local-data-api_1 ... done
Recreating local-data-api_db_1             ... done
Attaching to local-data-api_local-data-api_1, local-data-api_db_1
local-data-api_1  | 2021-04-03 04:08:54.069 [main] TRACE Application - {
local-data-api_1  |     # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 6
local-data-api_1  |     "application" : {
local-data-api_1  |         # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 7
local-data-api_1  |         "modules" : [
local-data-api_1  |             # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 7
local-data-api_1  |             "com.koxudaxi.localDataApi.ApplicationKt.module"
local-data-api_1  |         ]
local-data-api_1  |     },
local-data-api_1  |     # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 2
local-data-api_1  |     "deployment" : {
local-data-api_1  |         # application.conf @ jar:file:/app/local-data-api.jar!/application.conf: 3
local-data-api_1  |         "port" : 8080
local-data-api_1  |     },
local-data-api_1  |     # Content hidden
local-data-api_1  |     "security" : "***"
local-data-api_1  | }
local-data-api_1  |
local-data-api_1  | 2021-04-03 04:08:54.142 [main] INFO  Application - Autoreload is disabled because the development mode is off.
db_1              | 2021-04-03 04:08:54.269 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1              | 2021-04-03 04:08:54.269 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1              | 2021-04-03 04:08:54.410 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
local-data-api_1  | 2021-04-03 04:08:54.532 [main] INFO  Application - Responding at http://0.0.0.0:80
db_1              | 2021-04-03 04:08:54.560 UTC [20] LOG:  database system was shut down at 2021-04-03 04:08:25 UTC
db_1              | 2021-04-03 04:08:54.593 UTC [1] LOG:  database system is ready to accept connections
local-data-api_1  | Exception in thread "main" java.net.SocketException: Permission denied
local-data-api_1  |     at java.base/sun.nio.ch.Net.bind0(Native Method)
local-data-api_1  |     at java.base/sun.nio.ch.Net.bind(Unknown Source)
local-data-api_1  |     at java.base/sun.nio.ch.Net.bind(Unknown Source)
local-data-api_1  |     at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
local-data-api_1  |     at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134)
local-data-api_1  |     at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:550)
local-data-api_1  |     at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
local-data-api_1  |     at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506)
local-data-api_1  |     at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491)
local-data-api_1  |     at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
local-data-api_1  |     at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:248)
local-data-api_1  |     at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
local-data-api_1  |     at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
local-data-api_1  |     at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
local-data-api_1  |     at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
local-data-api_1  |     at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
local-data-api_1  |     at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
local-data-api_1  |     at io.ktor.server.netty.EventLoopGroupProxy$Companion$create$factory$1$1.run(NettyApplicationEngine.kt:227)
local-data-api_1  |     at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
local-data-api_1  |     at java.base/java.lang.Thread.run(Unknown Source)

To Reproduce
Steps to reproduce the behavior:

  1. Git clone this project
  2. Use docker-compose to start it docker-compose -f docker-compose-postgres.yml up
  3. Here is docker-compose-postgres.yml content

services:
  local-data-api:
    image: koxudaxi/local-data-api
    restart: always
    environment:
      ENGINE: PostgreSQLJDBC
      POSTGRES_HOST: db
      POSTGRES_PORT: 5432
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: example
      RESOURCE_ARN: 'arn:aws:rds:us-east-1:123456789012:cluster:dummy'
      SECRET_ARN: 'arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy'
    ports:
      - "8080:80"
  db:
    image: postgres:10.7-alpine
    restart: always
    environment:
      POSTGRES_PASSWORD: example
      POSTGRES_DB: test
    ports:
        - "5435:5432"
  1. See error

** Environment

  • OS: CentOS Linux release 7.6.1810
  • Docker: Docker version 20.10.5, build 55c4c88/docker-compose version 1.23.2, build 1110ad01
  • Version 0.6.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions